Quick question. Html.ActionLink and creating Internal Links ( #home, #about, etc. )

Posted by Gary '-' on Stack Overflow See other posts from Stack Overflow or by Gary '-'
Published on 2010-06-16T19:57:46Z Indexed on 2010/06/16 20:02 UTC
Read the original article Hit count: 311

Hi there, quick question...

How can I best create internal links? This is the markup I want to achieve:

<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>

Using MVC 2 I'm using, what's the best Html Helper to use?

<h3><%= Html.Encode(Model.Title) %>
<ul>

<% foreach ( var item in Model.Categories ) {%>
    <li><%= Html.RouteLink( item.Description, ???? ) %></li>
<%} %>

</ul>

What's the best way to get a url to an internal link? String.Format a link from scratch? There's gotta be a better way.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about mvc