1. @Html.ActionLink() 參考
也是使用在chtml模板中,返回參數中指定controller、指定action的所生成的超鏈接標簽<a>標簽html文本.如果沒有指定controller,則默認值為本頁面對應的Controller.
@model IEnumerable<MvcMusicStore.Models.Genre> <ul id="categories"> @foreach (var genre in Model) { <li>@Html.ActionLink(genre.Name, "Browse", "Store", new { Genre = genre.Name }, null) </li> } </ul>
2.Url.Action()
Url.Action() 使用在chtml模板中, 效果是返回的是指定控制器指定action的完整URL地址字符串,不含<a>標簽
<a href="<@Url.Action("SelectDetail","OutBox",new{letterid=m.LetterID})>">XXX</a>
3.Url.Content()
<li><a href="@Url.Content("~/StoreManager/")">Admin</a></li>
其它:參考
4.Html.Action與Html.RenderAction
5.Html.RenderPartial和Html.Partial