Passing Parameter To Html.ActionLink

Jun 23, 2013
Facebook Twitter Google Digg Reddit LinkedIn Pinterest StumbleUpon Email


While working with Asp Net MVC, one of the HtmlHelper we use to generate Hyperlinks in our views is Html.ActionLink. This is the Link Extension method we use to generate Hyperlink passing Controller and ActionMethod.

Now the question becomes of Passing parameter to controller action from a Html.ActionLink. For this you can use one of the overload available for this extension method.

Html.ActionLink

Following are the parameter descriptions.

  • Text Of The Hyperlink
  • Action Method
  • Parameter Of The ActionMethod

What if you want to pass Controller name to while using the Html.ActionLink. There in an overload available for this purpose to but it has an extra parameter that you need to be careful about.

First three parameters are same as above. But you have two additional parameters. One for the Controller and one for the Html Attributes in case you want to pass any. If none you still have to pass null for that parameter.

  • Controller Name
  • Html Attributes if any

Html.ActionLink With Controller