ASP.NET MVC 3 URL Routing problem with Custom Route?

I think you want this overload of the method. Add a null at the end.

Up vote 2 down vote favorite share g+ share fb share tw.

I have the following Custom URL Routing Rule: routes. IgnoreRoute("{resource}. Axd/{*pathInfo}"); routes.

MapRoute( "RaceRoute", // Route name "people/create/{raceid}/{id}", // URL with parameters new { controller = "People", action = "Create", raceid = UrlParameter. Optional, id = UrlParameter. Optional } ); routes.

MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter. Optional } // Parameter defaults ); Which I'm trying to use with Actionlink @Html. ActionLink("Add Person", "Create", "People", new { raceid = item.

RaceId, id="1" }) I basically want the url to look like "/people/create/5/1" But the HTML generated looks like Add Person It should say Add Person The page I'm on is http://localhost:57355/races If I do just @Html. ActionLink("Add Person", "Create", "People") then it works but I get no parameters. What am I missing?

Thanks asp.net-mvc asp.net-mvc-3 url-routing link|improve this question edited Mar 18 '11 at 17:56Martin5,7361835 asked Mar 18 '11 at 17:37Mike5491622 100% accept rate.

I think you want this overload of the method. Add a null at the end: @Html. ActionLink("Add Person", "Create", "People", new { raceid = item.

RaceId, id="1" }, null) Here is the overload: public static MvcHtmlString ActionLink( this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, RouteValueDictionary routeValues, IDictionary htmlAttributes ) or is it this one: public static MvcHtmlString ActionLink( this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, Object routeValues, Object htmlAttributes ).

Thank you very much for the help. – Mike Mar 18 '11 at 18:07.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions