Mvc Dynamic Menu Populating plain text

后端 未结 2 790
刺人心
刺人心 2020-12-21 21:16

I have created the N\'th level Dynamic Menu recursive method which creates a menu.

As seen in above picture the content is returned to ParialView named \"_M

2条回答
  •  借酒劲吻你
    2020-12-21 21:17

    Though War resolved my query above. But i still want to answer for people for whom the above answer seem complex. in most easiest possible way in MVC to populate Dynamic Navigation Menu from Database.

    in Controller:

        public ActionResult Index()
    {
        Menu menu_ = new Menu();
        ViewBag.Menu = menu_.getMenuList();
        return View();
    }
    

    in _layoutpage.Cshtml

            
    

提交回复
热议问题