Reputation: 354
I am trying to use Url.Action to specify an action, controller, and a model that I use to specify the parameters. This would look something like this: @Url.Action( "action", "controller", model)
I'm now trying to specify an Area as well. It appears that most suggestions are that you do it like this: @Url.Action( "action", "controller", new {Area = "area"})
Does anyone know how you specify a model and an Area?
Upvotes: 1
Views: 478
Reputation: 301
There is an overload for the Url.Action method that accepts an action, controller and RouteValueDictionary. To get around the issue of not being able to assign your area to your model you could do the following:
@{
var routeValues = new System.Web.Routing.RouteValueDictionary(model);
routeValues.Add("Area", "area");
}
@Url.Action("action", "controller", routeValues)
Upvotes: 2