0

I have created a MvcSite Map which contains Menu Itmes this Site Map is displayed on the shared layout page using @Html.MvcSiteMap.Menu(false,true,true)

i have a custom code in MenuHelpModel.cshtml file now i want to create some menuitmes when a user login i am getting the number of organization the user belongs which is dynamic "a user can be a member of n number of organization"

is there any way I can write the dynamic menu in the MenuHelpModel or do I need to write the Code in layout and use Jquery to populate the Menu?

Is there any way to use ViewBag inside jQuery?

рüффп
  • 5,172
  • 34
  • 67
  • 113
Nitin Bourai
  • 430
  • 7
  • 20
  • How do you determine which organizations a user belongs to? – Xharze May 09 '12 at 10:24
  • when user register for the website he has to register with an organization , a user can also register for other organizations just like google groups ,so when user login i will fetch the organizations from the Database – Nitin Bourai May 09 '12 at 10:31
  • I don't think this should be done in MvcSiteMapProvider. Probably better to populate it in the view. Why not just pass the information to the view? – Xharze May 10 '12 at 12:34

1 Answers1

0

This can be done the way you require. Firstly, you need to create a "Authorized" layout page. In this page you can setup your MvcSiteMap as per your code above. The authorized page loads this master page. You use the DynamicNodeProvider class to load up the organizations based on the Authenticated UserID.

Greg
  • 2,654
  • 3
  • 36
  • 59