Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
getting an error tree view is not defined

Razor
@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>



my controller action method is


C#
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);
      }
Posted
Comments
F-ES Sitecore 22-Nov-15 9:47am    
There is no such object as Treeview in MVC.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900