Hi All,
Trying to create a strongly typed master page with multi level navigation and would love to hear your opinion.
i'm using the sample recommended by MS here: http://www.asp.net/mvc/tutorials/passing-data-to-view-master-pages-vb
so i have an ApplicationController that gets all the categories and all the other controller inherits it. and it return a LIST and stores it in ViewData["Nav"]
The master page as a partial view that gets the NAV model and creates the menu. The roues for the category Category/{CategoryId}/{CategoryName}/{Page}
The question is how can i display the selected category or sub category as selected when i renders it inside the partialView.
I see some options: 1. Create another property in the applicatin controller :
public class CategoryController : AppliactionController
{
//
// GET: /Category/
public ActionResult Index(string categoryId, string categoryName, int page)
{
base.ActiveCategoryId=int.parse(categoryId);
return View();
}
- Check the current action URL in the partial view when creating the menu and set the category as selected if it produces the same action URL (not sure if i can get the categoryid from the action)
Any suggestions?