I want to create a URL like /?name=Macbeth&year=2011 with my ActionLink which I have tried doing like so:
<%= Html.ActionLink("View Details", "Details", "Performances", new { name = item.show }, new { year = item.year })%>
but it doesn’t work. How do I do this?
The overload you are using makes the
yearvalue end up in the html attributes of the link (check your rendered source).The overload signature looks like this:
You need to put both your route values in to the
RouteValuesdictionary like this: