Skip to content Skip to sidebar Skip to footer

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 ()

  1. Values specified in the Url.Action call, then
  2. Values specified in the request context for the current page, then
  3. Default values for the route.

Post a Comment for "Url.action(action,controller,routevalues) Doubling Up Id In Url"