문제

I'm trying to utilize the HTML.ActionLinks in MVC. I have a route definition like so:

routes.MapRoute(
    name: "RestaurantCommon",
    url: "Rest/{siteName}/Admin/{action}/{id}",
    defaults: new { controller = "AdminCommon", action = "Promotions", id = UrlParameter.Optional }
);

Is it possible to use ActionLinks to keep the "Rest" and "Admin" in the folder structure? Below is what I have. It works but doesn't keep the pattern I want (it works because of a default below the one I defined above)

<li>@Html.ActionLink("Burger Star", "Promotions", "AdminCommon", new { siteName="BurgerStar" }, null)</li>
도움이 되었습니까?

해결책

Use @RouteLink

@Html.RouteLink("Burger Star", "RestaurantCommon", new { siteName = "BurgerStar" })
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top