Hi I'm pretty new with MVC2 or MVC in general. If it's one thing I get caught up with it's routes. Like now I got this scenario. Im going from the regular site to Admin. My navigation is the same partialview on both I just do a check which data to render something like this.
<% if (!Request.RawUrl.Contains("Admin")){%>
<% foreach (var site in Model) { %>
<%= Html.MenuItem(site.BelongSite, "Sida", "Site", site.BelongSite) %> |
<%} %>
<%} else {%>
<%= Html.ActionLink("Konfig", "Konfigurera", "Admin") %>
<% } %>
My route looks like this
routes.MapRoute(
"Admin", // Route name
"Admin/{action}/{name}", // URL with parameters
new { controller = "Admin", action = "konfigurera", name = UrlParameter.Optional } // Parameter defaults
);
On my View called Konfigurera I got Edit sites and they use the route above and it works great. The navigation tho dont get no action assigned to it. It's just <a href='Admin/'>
The navigation is in the shared folder, and it is a strongly typed. Any Ideas? I been struggling with this for about a hour now
Thanks for any input
EDIT
this is just one of those omg I'm so stupid moments. Ofcause the the link gone be only <a href='Admin/'
because it's the default link (as the default values of the route). I noticed this as I put more links to the Admin navigation and they was ok. Well hope this can help anybody in the same situation as I had.
I wonder how I should do if I come up with the solution myself?