This is a migrated thread and some comments may be shown as answers.

[Solved] Is it possible to pass route values in xml sitemap?

2 Answers 66 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Connor
Top achievements
Rank 1
Connor asked on 16 May 2011, 04:57 PM
Our website is using xml sitemaps to generate our main menu using the Telerik Menu.  Since it is the main menu we need to links to be to the default state of that page.  However the mvc framework tries to be smart and fill in empty route values with ones from current url where the names are equal.  This means if I am on a page that has a route value of page and I have a menu item that goes to another view also with route value page, it will use the current page number for the link.  Now I have a very confused user as to why they are starting off on a page other then the first when they did not say next page.

Is there some way to pass in routeValues in the xml sitemap so the route url object won't try and use the current page's values?

We are using Telerik Mvc version 2011.1.414.

Thanks
Connor Ross

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 19 May 2011, 02:55 PM
Hello Connor,

 
You can add custom  attributes to the siteMapNode like so:

<siteMapNode controller="grid" action="serverbinding" title="Server Binding" id="23" />
and then you can access it in the menu like so:
.BindTo("sample", (item, node) => {
           if (node.Attributes["id"] != null)
           {
               item.RouteValues.Add("id", node.Attributes["id"]);
           }
       })


Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Connor
Top achievements
Rank 1
answered on 20 May 2011, 01:23 AM
Georgi,

Thanks.  That works great, I can put a little flag in there to reset that route value if the node has the attribute.

Connor Ross
Tags
Menu
Asked by
Connor
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Connor
Top achievements
Rank 1
Share this question
or