on the .master website page, call
<div id="menu-link"> <% Html.RenderAction("Action", "Controller"); %> </div>
you can call an action in your homecontroller if you want, and just return a partial html view to it, in your case some menu links.
public class HomeController: Controller { public ViewResult Menu() { var viewModel = new ViewModel(); viewModel.MenuLinks = _repository.GetMenuLinks(); return PartialView("MenuPartial", viewModel); } }
you can create a partial "MenuPartial.ascx"
<% foreach(var link in Model.MenuLinks) { %> <%: link.Name %> <% }%>
source share