I need to create a list of menu items server side and then bind to the kendo menu, but I am unable to create items with child items.
View:
@model IEnumerable<
MenuItem
>
@(Html.Kendo().Menu()
.Name("Menu")
.BindTo(Model))
I was unable to find a way to make childOne and childTwo children of the parent menuItem and added to the allMenuItems list
The allMenuItems is what I am passing to the View
var parent =
new
MenuItem() {Text =
"Parent"
};
var childOne =
new
MenuItem() { Text =
"Child 1"
, ActionName =
"Foo"
, ControllerName=
"Bar"
};
var childTwo =
new
MenuItem() { Text =
"Child 2"
, ActionName =
"Foo2"
, ControllerName =
"Bar"
};
var allMenuItems =
new
List<MenuItem>();
I need some sample code showing how to build this list server side.
Thank you.