This question is locked. New answers and comments are not allowed.
Hi, I am using MVC Menu and would like to dynamically create some menu items from the controller, while still using standard menu construction: Example below:
<% Html.Telerik().Menu() |
.HtmlAttributes(new { style= "border: 0;" }) |
.Name("Menu") |
.Items(menu => |
{ |
menu.Add() |
.HtmlAttributes(new { style = "border-right: 0;" }) |
.Text("Process") |
.Content(() => |
{%> |
<!-- create dynamic menus in controller --> |
<%}); |
menu.Add() |
.HtmlAttributes(new { style = "border-right: 0;" }) |
.Text("Print") |
.Items(item => |
{ |
item.Add().Text("Welcome Letter") |
.Action("PrintWelcomeLetter", "Services", new { id = ViewData["ClientProcessID "] }) ; |
item.Add().Text("Application Form") |
.Action("PrintApplicationForm", "Services", new { id = ViewData["ClientProcessID "] }) ; |
}); |
menu.Add() |
.HtmlAttributes(new { style = "border-right: 0;" }) |
.Text("Attachments") |
.Items(item => |
{ |
item.Add() |
.Text("Add Attachment") |
.Action("AddServiceAttachment", "Services", new { id = ViewData["ClientProcessID"] }); |
}); |
}) |
.Render(); |
%> |
Based on route data I would be wanting to output different menu options which allow the user to move to the next stage in the process.
I assume it is best to do this with the Content feature using ViewData, however being quite new to this I would appreciate some assistance in how to construct the menu items in the controller dynamically.
I'm using MVC 1 with C#, any assistance would be greatly appreciated.
Many Thanks,
Kent.