码迷,mamicode.com
首页 > Web开发 > 详细

HTML.ActionLink vs Url.Action in ASP.NET Razor

时间:2015-04-30 10:16:28      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

Html.ActionLink generates an <a href=".."></a> tag whereas Url.Action returns only an url.

For example:

@Html.ActionLink("link text", "someaction", "somecontroller", new { id = "123" }, null)

generates:

<a href="/somecontroller/someaction/123">link text</a>

and Url.Action("someaction", "somecontroller", new { id = "123" }) 

generates:

/somecontroller/someaction/123

HTML.ActionLink vs Url.Action in ASP.NET Razor

标签:

原文地址:http://www.cnblogs.com/billion-win/p/4468024.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!