Reputation: 21328
Is there a way to pass a Dictionary<string, string>
to Html.ActionLink()
?
var myDictionary = new Dictionary<string, string> { { "serviceId", "2342" } }
I tried doing this:
Html.ActionLink("Text here", "Action","Controller", myDictionary, null)
but that doesn't work
Upvotes: 0
Views: 1293
Reputation: 1038820
You could use the following overload:
<%= Html.ActionLink(
"Text here",
"Action",
"Controller",
new RouteValueDictionary(myDictionary),
null
) %>
where myDictionary
should be an IDictionary<string, object>
.
Upvotes: 3