Skip to content

Instantly share code, notes, and snippets.

@loonison123
Created May 18, 2014 04:56
Show Gist options
  • Select an option

  • Save loonison123/7be83c5a3f76f9c7d03a to your computer and use it in GitHub Desktop.

Select an option

Save loonison123/7be83c5a3f76f9c7d03a to your computer and use it in GitHub Desktop.
New way of loading a menu from json file in MVC BaseController
public class BaseController : System.Web.Mvc.Controller
{
public BaseController()
{
Initialize();
}
protected void Initialize()
{
// ...
// GetMenu();
}
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
base.OnActionExecuted(filterContext);
this.GetMenu();
}
private void GetMenu()
{
// Do something with query string and render differently...
// Request.QueryString is not null!!!
NavGenertor navGenerator = new NavGenerator();
App.Menu = navGenerator.GetTopNav();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment