Using Twitter.Bootstrap.MVC4 allows you to pass "null" to the Client Controller in ExampleLayoursRoute.config:
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapNavigationRoute<HomeController>("Home Page", c => c.Index());
routes.MapNavigationRoute<CustomerController>("Customer", null) <-- pass null here
.AddChildRoute<CustomerController>("List", c => c.Index())
.AddChildRoute<CustomerController>("Add", c => c.Create())
;
}
I get an error: the object reference is not installed in the object instance in the NavigationRouteconfigureationExtensions.cs file:
public static NamedRoute ToDefaultAction<T>(this NamedRoute route, Expression<Func<T, ActionResult>> action,string areaName) where T : IController
{
var body = action.Body as MethodCallExpression; <--- Error here
You cannot add a link to the same controller / action:
routes.MapNavigationRoute<CustomerController>("Customer", c => c.Index())
.AddChildRoute<CustomerController>("List", c => c.Index())
Or you get an error message: {"The route with the name" Navigation-Customer-Index "is already in the route collection. The route names must be unique. \ R \ nParameter: name"}
My only workaround so far is to add a second duplicate of Action to the controller and its name is Index2 (for example):
public ActionResult Index()
{
return View(db.Customers.Where(x => x.UserName == User.Identity.Name).ToList());
}
public ActionResult Index2()
{
return View(db.Customers.Where(x => x.UserName == User.Identity.Name).ToList());
}
, ?
,