I've read a lot about XmlSiteMapProvider. It's nice to be able to put URLs in an XML file and bind them dynamically. But, URLs often need query string parameters appended to them so that they can do something like initiate an action. For example, you may have a grid with items like:
[ Unique ID ] [ Title ] [ Details ] [ Popup Actions Menu ]
[ 1 ] [ Item ] [ Great! ] [ { Send to Friend, View Details, Search Google } ]
Imagine that Popup Actions Menu is an instance of asp:Menu and is bound to a sitemap provider that creates a popout menu based on the current row in the grid.
In each case, Send to Friend, View Details, and Search Google will have associated URLs, but will require parameters to be appended.
What is the best way to achieve this in asp.net 2.0?
I thought that I could store the "format string" of the URL as the URL property in the XML file, and then in pre render, just cycle through and update the URL properties of each node. Then I read that the nodes are read only. I haven't tried it yet, so I'm wondering if others have done something similar.
I would like to use asp:Menu because it does a nice thing: it pops the menu _within the available screen real estate_ as best it can. If you scrunch your screen down to 400 pixels wide, it will pop it way over to the left in order to have it viewable. This is very nice, and a lot of commercial controls don't do this, especially with their fancy "ComboBox" or "Styled List Box" controls.
I also want to build on top of the security trimming available in the sitemap provider.
Update: Quick Start Info Addresses This
If you didn't know better, you could accuse me of stealing the first line of the QuickStart section about this topic! Check it out:
http://asp.net/QuickStart/aspnet/doc/navigation/sitenavapi.aspx
"The navigation data contained in web.sitemap that is consumed by the XmlSiteMapProvider is static - the data is loaded into memory and stored as read-only data. However, many sites have a navigation structure that is parameterized based on querystring values."
Further on:
"The Site Navigation feature exposes the SiteMapResolve event on the SiteMapProvider base class. An event subscription can be made using either SiteMap.SiteMapResolve or directly against individual providers using SiteMap.Provider.SiteMapResolve. The return value from the event is a SiteMapNode instance. In your event handler you can write custom logic to create a hierarchy of SiteMapNode instances. This logic can modify the properties on each SiteMapNode so that properties like URL and Title reflect additional information based on data taken from the querystring."
I'll try this!