[英]Generate Full URL ASP.NET MVC Razor Views
I am trying to generate the full URL for a route link in my razor view for ASP.NET MVC 3. I know I can use Html.RouteLink to generate a link however all I want is the URL, not the surrounding a tag wrapper. 有没有办法做到这一点?
你在说:
<a href="@Url.Action("Action", "Controller", new { @id = "2" })">
Link to Page</a>
对比
@Html.ActionLink("Link to page", "Action", "Controller", new { @id = "2" })
Url
Model 仅构建链接; Html
构建了 HTML。
使用UrlHelper 。
Url.RouteUrl( "MyRoute" )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.