0
我在控制器的动作:如何将参数添加到mvcSiteMapNode?
public ActionResult Close(DocType docType)
{
return View();
}
其中的DocType是一个简单的枚举。 我想有2个不同的链接到相同的动作,但具有不同的参数。我曾经尝试这样做:
<mvcSiteMapNode title="Accounting" clickable="false" imageUrl="~/Content/Images/Buttons/MenuButtons/billing.png" visibility="path">
<mvcSiteMapNode title="Payments" controller="Payment" action="Index"></mvcSiteMapNode>
<mvcSiteMapNode title="Closing WO" controller="Payment" action="Close" docType="2"></mvcSiteMapNode>
<mvcSiteMapNode title="Closing WS" controller="Payment" action="Close" docType="4"></mvcSiteMapNode>
</mvcSiteMapNode>
但在菜单我有2个链接不带任何参数:“/支付/关闭”
有什么不对? 如何将参数添加到mvcSiteMapNode中?
这里是我的RouteConfig:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
这听起来像一个路由问题。请显示您的路由配置。你是否有一个带有{docType}参数的路由? – NightOwl888
不,我没有这样的路线。我想只使用带可选id参数的默认路由 –