Asp.net-Mvc
ASP.NET MVC:生成帶有自定義 html 的操作連結
如何生成內部帶有自定義 html 的操作連結。
如下:
`<a href=“http://blah-blah/…..">
<span class=“icon”/> New customer
</a>`
您可以使用 UrlHelper 類:
<a href="<% =Url.Action("Create","Customers") %>"> <span class="icon"/> New customer </a>MSDN 連結在這裡:http: //msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.aspx
對於較新版本的 .net,
代替
href="<% =Url.Action("Create","Customers") %>"和
href="@Url.Action("Create","Customers")"給予類似的東西
<a href="@Url.Action("Create","Customers")"> <span class="icon"/> New customer </a>