@model List<AdwaniMVCNew.Models.Menu> @{ ViewBag.Title = "Simple"; } <h2>Simple Treeview from Database Data</h2> <div style="border:solid 1px black; padding:10px; background-color:#FAFAFA"> <div class="treeview"> @if (Model != null && Model.Count() >0) { <ul> @Treeview.GetTreeView(Model, Model.FirstOrDefault().ParentId) </ul> } </div> </div>
public ActionResult Simple() { List<Menu> all = new List<Menu>(); using (AdwaniContext db = new AdwaniContext()) { all = db.Menus.OrderBy(a => a.ParentId).ToList(); } return View(all); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)