ASP.NET MVC: generating action link with custom html in it

两盒软妹~` 提交于 2019-12-10 03:15:09

问题



How can I generate action link with custom html inside.
Like following:
<a href="http://blah-blah/.....">
<span class="icon"/> New customer
</a>


回答1:


You can use the UrlHelper class :

<a href="<% =Url.Action("Create","Customers") %>">
    <span class="icon"/> New customer
</a>

The MSDN link is here : http://msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.aspx



来源:https://stackoverflow.com/questions/3879547/asp-net-mvc-generating-action-link-with-custom-html-in-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!