我有一个名为区域MyArea和它的登记,像这样:ASP.Net MVC路线问题
context.MapRoute(null, "MyArea", new { controller = "MyAreaController", action = "Index" });
//Properties
context.MapRoute(null, "MyArea/properties", new { controller = "Property", action = "Index" });
context.MapRoute(null, "MyArea/properties/edit/{propertyId}", new { controller = "Property", action = "Property" });
//Units
context.MapRoute(null, "MyArea/properties/edit/{propertyId}/units/{unitId}", new { action = "Unit", propertyId = 1, unitId = 1 });
它应该是一个酒店有很多单位,所以我想我的网址看起来是这样的:
http://localhost:50182/myarea/properties/edit/4/units/1
我使用的Html.ActionLink的代码如下所示:
@Html.ActionLink("Add new Unit", "Unit", "Unit", new { propertyId = 1, unitId = 1 })
我有一个单位控制器与一个称为单位的行动。请帮助,我错过了什么?
谢谢!
你面临什么问题? – 2011-03-29 13:46:59
链接转到http:// localhost:50182/myarea/properties/edit/4/units?controller = Property&Length = 4 而不是: http:// localhost:50182/myarea/properties/edit/4/units/1 我收到以下错误消息: 值不能为空或为空。 参数名称:controllerName – Pete 2011-03-29 13:50:19