How to generate hyperlink with specific ID

Jul 28, 2011 at 11:22 AM


My MvcSiteMap is working a treat. However, I'd like to be able to set one menu item and have it refresh using AJAX every 30-60 seconds (number of messages in Inbox).

One way of achieving this is setting the menu item to use an ID which can be grabbed using a JQuery selector, and then updated the hyperlink caption after issuing an AJAX call.  The dynamic node provider is OK, but limitations with it are that I don't want the value cached, and the value will only refresh on a page refresh which is not suitable.

I'm not sure how to get the MvcSiteMap library to output a specific ID in the hyperlink tag.
Is there any way of doing this?

Aug 26, 2011 at 1:30 PM

You can add "data-id" in the node definition and output that yourself in the template used for rendering a URL.

Aug 26, 2011 at 1:39 PM
Edited Aug 26, 2011 at 1:39 PM

Can you let me know how you add data-id into the node definition and also what you mean about the template rendering.  I'm using Razor views.

Thanks for your help.