Could someone show me the syntax of an Html.ActionLink that will produce a hyperlink that looks like this:
<a h ref="/mycontroller/myaction/67">mylinktext</a>
thanks. Terrence
Could someone show me the syntax of an Html.ActionLink that will produce a hyperlink that looks like this:
<a h ref="/mycontroller/myaction/67">mylinktext</a>
thanks. Terrence
To generate a link, use the HtmlHelper and the Action extension...
<%= Html.ActionLink ("mycontroller", "myaction", new { id = 67 }) %>
It depends more on how you set up your routes. But if you only have the default route and myaction
takes one parameter named id it can look like this:
<%=Html.ActionLink("mylinktext", "myaction", "mycontroller", new { id = 67 }, null) %>
Or, if you want and have mvc features or mvc2, it can look like this:
<%=Html.ActionLink<mycontroller>(x => x.myaction(67), "mylinktext")%>