Hello,
An easy and convenient way to avoid hard-coding in this code implementation would be to use the RadMenu
ItemDataBound event. This event is fired for each menu item and you are able to access the current site map node in the e.Item.DataItem and cast that object to site map node. As far as I understand you have a drop-down that shows the current language preference so based on that value you are absolutely able to control the menu item text. So you can define your french translation for each site map node as a custom attribute. In the attached example the site map node with title "Home" has a custom attribute "frenchValue". In the RadMenu1_ItemDataBound event handler is shown how to access that custom value and set the current menu item's text value to that value.
Alternative way would be on Page_Init to determine which language preference is selected and load different site map file. In the code snippet is shown how you can load a french site map file if the current language preference is french.
//code behind
In this case you will not need to use the RadMenu ItemDataBound handler.
Regards,
Boyan Dimitrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the
blog feed now.