【发布时间】:2010-06-16 19:57:46
【问题描述】:
快速提问...
如何最好地创建内部链接?这是我想要实现的标记:
<h3>Title</h3>
<ul>
<li><a href="#prod1">Product 1</li>
<li><a href="#prod2">Product 2</li>
<li><a href="#prod3">Product 3</li>
...
<li><a href="#prod100">Product 100</li>
</ul>
<div id="prod1">
<!-- content here -->
</div>
使用我正在使用的 MVC 2,最好使用的 Html Helper 是什么?
<h3><%= Html.Encode(Model.Title) %>
<ul>
<% foreach ( var item in Model.Categories ) {%>
<li><%= Html.RouteLink( item.Description, ???? ) %></li>
<%} %>
</ul>
获取内部链接网址的最佳方式是什么? String.Format 从头开始的链接?一定有更好的办法。
【问题讨论】:
标签: asp.net-mvc model-view-controller asp.net-mvc-2 html-helper hyperlink