Issue with Menu Generation (URL Parameters)

Nov 13, 2010 at 5:16 PM

I am using the latest version of the source code.  When I access a URL with a parameter specified and the page is rendered, I see that the links in the menu that are not supposed to have a parameter, now have the current parameter appended to the end of them.

Sitemap snippet:

<mvcSiteMapNode title="What's New" controller="page" action="general-info/whats-new" />
<mvcSiteMapNode title="General Information" controller="page" action="general-info" />
<mvcSiteMapNode title="Technical Information" controller="page" action="tech-info" />

Example:

Navigated URL: http://localhost:1234/page/general-info/whats-new

Menu Shows:

http://localhost:1234/page/general-info/whats-new
http://localhost:1234/page/general-info/whats-new
http://localhost:1234/page/tech-info/whats-new

 

Any ideas on what is causing this, and possibly how to resolve it?

Thanks,
Daniel 

Coordinator
Nov 15, 2010 at 10:34 AM

Can you show me the route table tou are using and a snippet of PageCOntroller?

Nov 17, 2010 at 2:42 PM

How do I get the route table?

 

PageController.cs

public class PageController : Controller
{
//
// GET: /Page/

[ActionName("general-info")]
public ActionResult GeneralInfo(string pageName, string subcontext = "")
{
var pageParam = XmlLoader.LoadPage("page""general-info", pageName, subcontext);
return View("GeneralInfo", pageParam);
}

[ActionName("tech-info")]
public ActionResult TechInfo(string pageName, string subcontext = "")
{
var pageParam = XmlLoader.LoadPage("page""tech-info", pageName, subcontext);
return View("TechInfo", pageParam);
}

...
}

 

Coordinator
Nov 18, 2010 at 6:03 AM

The one in your global.asax.cs

 

Oh by the way, change <mvcSiteMapNode title="What's New" controller="page" action="general-info/whats-new" /> into <mvcSiteMapNode title="What's New" controller="page" action="general-info" />, the first one will confuce ASP.NET MVC...

Nov 18, 2010 at 2:32 PM

I know where the RouteTable is, what do you need to see?  What routes I add into it, or the routes in the RouteTable, from the property RouteTable.Routes ?

If I make the change as suggested, how can I make my menus display properly?  It needs to navigate to http://localhost:1234/page/general-info/whats-new, not http://localhost:1234/page/general-info.

Coordinator
Nov 19, 2010 at 8:05 AM

The routes you are adding is fine.