Url.action(action,controller,routevalues) Doubling Up Id In Url
I am using the following code (taken from a Stackoverflow post: Action Image MVC3 Razor ) in an HTML extension helper to build an action link. My Url.Action() method is returning
Solution 1:
When you pass routeValues to the url.action
method it will use the values to override the currently defined ones (in the request context for the current page).
So when the current status is Tabled
and you do not reset that in the new routeValues you pass, then it will still use it..
But since you pass an id as well it adds that too..
You need to pass New With {.id = Model.StatusFilter, .status = nothing}
the hierarchy is ()
- Values specified in the Url.Action call, then
- Values specified in the request context for the current page, then
- Default values for the route.
Post a Comment for "Url.action(action,controller,routevalues) Doubling Up Id In Url"