Dynamic RouteData

Oct 14, 2009 at 6:46 PM

I just found this excellent piece of code.

I have a requirement that i think cant be solved as it is right now. Pleade correct me if i am wrong.

 

I want to generate a Breadcrumb that looks something like this.

Home

Home > Products

Home > Products > Product A

 

So for so good, but now i want child nodes under Product A, like so:

Home -> Products -> Product A -> Edit

 

This works excellent except the link for "Product A"  doesn't include the Id route data in the url. I want the url to be http://site.com/Product/View/<id> but it just becomes http://site.com/Product/View/

 

Am i overlooking something? Or am i thinking fundamentally wrong about this thing? Suggestions and help is welcome.

 

My definition looks something like this:

 

<mvcSiteMapNode title="Products" controller="Prodcut" action="Index" isDynamic="true" dynamicParameters="*">
<mvcSiteMapNode action="View" isDynamic="true" dynamicParameters="id">
<mvcSiteMapNode action="Edit" isDynamic="true" dynamicParameters="id" />
</mvcSiteMapNode>
</mvcSiteMapNode>

 

<mvcSiteMapNode title="Products" controller="Prodcut" action="Index" isDynamic="true" dynamicParameters="*">

<mvcSiteMapNode action="View" isDynamic="true" dynamicParameters="id">

<mvcSiteMapNode action="Edit" isDynamic="true" dynamicParameters="id" />

</mvcSiteMapNode>

</mvcSiteMapNode>

 

 

 

Coordinator
Oct 15, 2009 at 10:47 AM

Check the example project on the downloads page, the same functionality is in there. You can set the parent node's parameters on the Edit action, for example.

Jan 25, 2010 at 9:32 AM

Unfortunately the example project proves what yodiz was saying, it doesn't keep the parent URL correctly. For example:

http://localhost:7826/Products/Details/Toy%20Story%202

If you then click on the "DVD" link in the crumbtrail, you're returned to the books section.

 

 

Coordinator
Jan 25, 2010 at 12:05 PM

Fixed in the latest sources - http://mvcsitemap.codeplex.com/SourceControl/list/changesets