asp.net mvc - RouteLink as linkname -
Is the rendering link equally available in the form of a name?
i.e
& lt;% = HTML Route Link (...., "myRoute", new {id = 75})%>
is provided as
& lt; A href = "http: // foo / something / 75" & gt; Http: // foo / something / 75 & lt; / A & gt;
Is there a clean move?
/ m
You create an extension method to manage it for yourself Public String PrintRouteLink (This HtmlHelper Assistant, String Routine Name, Ent ID) {UrlHelper url = new UrlHelper (helper.ViewContext.RequestContext); Return Assistant. Route link (url.RouteUrl (path name, new {id = id}), street name, new {id = id}); }
Then you can use it:
& lt;% = Html.PrintRouteLink (route name, 75)%>
Comments
Post a Comment