1

How to create dynamic menu on views in asp.net mvc 2.0?

1

2 Answers 2

2

Could you be a bit more spesific maybe?

If it's just a list of links it's easy enough, you just loop trough them an output a link with the Html.Action helper.

Something like:

<div class="menu">
<% // From the Controller we got the following list of links as a IEnumerable<String> { "Home", "About" } put in Model.
foreach(var lAddr in Model) { %>
    <%= Html.Action(lAddr, lAddr) %><br />
<% } %>
</div>

This should hender something like (if in an Controller named Home):

<a href="/Home/Home">Home</a><br /><a href="/Home/About">About</a>
Sign up to request clarification or add additional context in comments.

Comments

0

Use JQuery menu.

http://p.sohei.org/stuff/jquery/menu/demo/demo.html

Use controller to build ViewData for menu. Build the Menu in view by iterating over the ViewData for Menu.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.