Will asp-route to take a collection of parameters?
properties = new { id = 21, sort_order = "desc", pageNum = 1}
You can add additional parameters to the route using asp-route-*, where * is the name of the parameter you want to add. Something like this: <a asp-route="routeName" asp-route-id="23" asp-route-sort_order="desc" asp-route-pageNum="1" asp-route-foo="@foo"></a>.
I understand. But what if I want to use a dynamic collection of parameters? Or will be available only to the static enumeration?
Ah, makes sense. You can add this yourself right now by deriving from our tag helper and adding the property collection. We can also look at supporting this directly.
Hello,
Some progress on this?
You can do this like this:
@{
var routeValues = new Dictionary<string, string>();
... // Add to routeValues
}
<a ... asp-all-route-data="routeValues">....</a>
What if I need to pass values collection? For example:
<a href="@Url.Action(...., new { Values = new [] { "Foo", "Bar" } })"
Is this possible with asp-all-route-data?
I think it can be IDictionary<string,object> instead of IDictionary<string,string>
Most helpful comment
What if I need to pass values collection? For example:
Is this possible with
asp-all-route-data?I think it can be
IDictionary<string,object>instead ofIDictionary<string,string>