Skip to content Skip to sidebar Skip to footer

@html.actionlink One Works And One Does Not

I have two @Html.ActionLink's one works and one does not and I cannot figure out why? They are both within the same controller: StoreController and both call ActionResults within d

Solution 1:

Use it like this

@Html.ActionLink("Check Availability", "CheckAvail", "Booking", new { @id = item.ShowId },null)

It is using this overload

publicstaticMvcHtmlStringActionLink(
    thisHtmlHelper htmlHelper,
    string linkText,
    string actionName,
    string controllerName,
    Object routeValues,
    Object htmlAttributes
)

http://msdn.microsoft.com/en-us/library/dd504972.aspx

the last parameter is the HTML attribute. If you have some HTML atribute to pass, you pass it there instead of null

@Html.ActionLink("Check Availability", "CheckAvail", "Booking", new { @id = item.ShowId },new { @class="myCssClass"} )

Post a Comment for "@html.actionlink One Works And One Does Not"