0

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>
Jon Harding
  • 4,928
  • 13
  • 51
  • 96
  • What do you mean by 'to keep the Rest and Admin in the folder structure'? – Deepal Apr 17 '14 at 05:14
  • what you need is RouteLink not ActionLInk refer http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.routelink(v=vs.118).aspx – Vishal Sharma Apr 17 '14 at 05:50

1 Answers1

1

Use @RouteLink

@Html.RouteLink("Burger Star", "RestaurantCommon", new { siteName = "BurgerStar" })
Yorro
  • 11,445
  • 4
  • 37
  • 47