Display a dynamic node in the breadcrumb and the sitemap

Mar 1, 2010 at 3:25 PM

Hi,

 

I've got the MVC sitemap set up nicely, apart from one issue. I need a node that dynmaic maps to an action with parameters to appear in the breadcrumb and the sitemap. I've tried setting the visibility to "Full" but this has no effect. I've defined the following node:

<mvcSiteMapNode title="Gallery" controller="Gallery" action="Index"  isDynamic="true" dynamicParameters="IndexPageNum">

...

</mvcSiteMapNode>

that also contains sub nodes. If I define it as shown above the breadcrumb appears perfectly - but it then the node doesn't appear in the SiteMap when using <%=Html.SiteMap(Model) %> in a view. If I don't set the isDynamic and dynamicParameter attributes it appears in the SiteMap - but then not in the breadcrumb. How do I get it to appear in both? I thought that was what the visibility attribute was for.

 

Regards,

Simon

Coordinator
Mar 12, 2010 at 7:06 PM

This is standard behaviour: setting a node to dynamic means that the sitemap will not know what the dynbamic paramneter is, and therefore will not render this in the Html.SiteMap method.
There is currently no way to add all pages of your gallery to the sitemap hoelper. SiteMapPath will behave as expected.

Mar 17, 2010 at 11:01 AM

Maarten,

Thanks for your reply (and you hard work on SiteMap). I suspected that it was standard behaviour. Unfortunately it means I won’t be able to use the SiteMap feature. I will still use the SiteMapPath (bread crumb), that works really nicely. But the particular node with the dynamic parameters is the biggest element of my site and not displaying it in the SiteMap would seem very odd to the user.

It’s a pity we can’t specify some default values for the dynamic parameters that the SiteMap could use to point to a specific page, but the SiteMapPath would ignore.

From: maartenba [mailto:notifications@codeplex.com]
Sent: 12 March 2010 19:07
To: simon.lomax@ntlworld.com
Subject: Re: Display a dynamic node in the breadcrumb and the sitemap [mvcsitemap:203418]

From: maartenba

This is standard behaviour: setting a node to dynamic means that the sitemap will not know what the dynbamic paramneter is, and therefore will not render this in the Html.SiteMap method.
There is currently no way to add all pages of your gallery to the sitemap hoelper. SiteMapPath will behave as expected.

Read the full discussion online.

To add a post to this discussion, reply to this email (mvcsitemap@discussions.codeplex.com)

To start a new discussion for this project, email mvcsitemap@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Coordinator
Mar 17, 2010 at 1:47 PM

Would something like the following be of use?

<mvcSiteMapNode .... dynamicValueProvider="SampleDynamicValueProvider"/>

class SampleDynamicValueProvider {
  public List<Dictionary<string, string>> RetrieveAvailableDynamicValues( RequestContext contect ) {

  }
}

Mar 18, 2010 at 6:57 PM

I presume you're suggesting we could then override the RetrieveAvailableDynamicValues method and return all possible dynamic values, which in turn would be used to populate the site map nodes. Yes, that would work nicely.

 

Regards,

Simon

Coordinator
Mar 19, 2010 at 8:06 AM

Still thinking about a clean way to do this, because this approach would mean that a lot of stress can possibly be on a database connection providing dynamic values.