Please see my other MVC article.
Building Links from Model Data
This article illustrates how to build a link within an MVC view which passes model data as a query string variable.
First, I begin with my “model” statement exposing my RaveUser model’s properties.
Next, I provide an ActionLink() statement with text for the link (“Reload All Values”), the name of the controller function to call (“LoadSelectedUser”), and finally, pass to the ActionLink() statement the SNumber property of the model.
As you can see, when the page displays and the Razor engine renders the HTML, the link displays as expected, passing the current user’s SNumber (1-8) as the query string value.