I have an MVC 2.0 application where I have a list of items that can be browsed by their first letter and I have a tab on the master page for the whole list of items.
What I would like is that the tab on the master page always should go to:
/items
And there are the letters of the abc that go to the items starting with the letter. So for example for the a
it should go to:
/items/a
To generate the link for the tab in the master page I use:
Url.Action("Index", "Items")
The problem is that if I am looking at the items starting with a
, so I am at /items/a
then the tab also points to this location and not just /items
.
Anyone knows why is that, and what can I do to always point to /items
in the tab using proper UrlHelper methods?
EDIT: and my routs are the following:
routes.MapRouteLowercase(
"DefaultPrefixed", // Route name
"{controller}/{action}/{q}", // URL with parameters
new { controller = "Items", action = "Index", q = "" }, // Parameter defaults
new { q = @"[a-z]{1}" } // constraint
);
routes.MapRouteLowercase(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);