MVC: pass parameter to view?

后端 未结 5 435
梦谈多话
梦谈多话 2020-12-14 19:52

MVC newbie question:

I\'m picking up a URL of the form go/{mainnav}/{subnav}, which I\'ve successfully routed to the GoController class, me

5条回答
  •  一个人的身影
    2020-12-14 20:12

    If you are using MVC3 I would suggest passing the values into the ViewBag.

    ViewBag.MainNav = "xxxx";
    ViewBag.SubNav = null;
    

    then on your view page, where you define the JavaScript and add the value.

    if you dont have MVC 3 if you use ViewData["MainNav"]), to store your value has the same effect.

提交回复
热议问题