dynamic parameter usage

Apr 13, 2010 at 2:27 PM

mvcSiteMapNode title="Upload Document" controller="Applications" action="CreateApplicationDocuments" isDynamic="true" dynamicParameters="id"/

Not sure if I am missing teh point of dynamic parameters here. With the above node, adn using the html helpers provided, should the hgnerated links look lime the following:

/Applcations/CreatApplicationDocuments/123

All I see is:

/Applcations/CreatApplicationDocuments

Any help appreciated...

Apr 13, 2010 at 4:17 PM

From my limited understanding, what you are seeing is what is intended. However, at /Applcations/CreatApplicationDocuments/123 the breadcrumb would read Applications >> CreatApplicationDocuments, whereas without the dynamic parameter this would fail to be recognized. I hope I'm not mistaken and mislead you.

Apr 14, 2010 at 3:06 AM

Ok - that makes sense then. Its really about recognising the structure, NOT about generating it.

Problem now is how I get my menu to have the current id embedded in the links...I can do this, but not through sitemaps - should I be able to??

Thank you for the speedy response...

Apr 14, 2010 at 6:45 AM

You should add it to the node yourself at this time. Check the sample included under ProductsController.

Apr 14, 2010 at 7:12 AM

Thanks, will look into that - and probably a better approach than my quick fix.

In case anyone is interested in said quick fix, I used a javascript (jquery) approach to adding my param to the links, as follows:

 $(".nav-main a").each(function() {
                if (!endsWith($(this).attr("href"), '<%= ViewData["id"]%>')) {
                    $(this).attr("href", $(this).attr("href") + '/<%= ViewData["id"]%>');
                }
            });

function endsWith(str, suffix) {
            return str.indexOf(suffix, str.length - suffix.length) !== -1;
        }

 It would be even simpler, however one of the links in the menu (current page) will already have the param, while others will not.