I am trying to figure out how to disable the ability to click a root item in the RadMenu control or at least stop the selected style from applying to it. The radmenu is populated via a sitemap file and the root nodes do not have a URL defined for them. I have tried to set all root items with the postback of false via the code below:
However, this doesn't do anything and I can still click the node and when I do, the clicked style will still apply. The only time I want the clicked selected style to apply to the root node is if a child node has been selected. Any assistance would be greatly appreciated.
6 Answers, 1 is accepted
I added this, but I am getting an error, below is my markup for the radmenu and the code you provided and following is the error:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; Tablet PC 2.0)
Timestamp: Fri, 4 Dec 2009 16:21:33 UTC
Message: Expected '}'
Message: 'null' is null or not an object
This cancels the clicking :)
Thanks for the quick replies!
Below is the code I used to achieve this:
In the above I define two custom attributes in my sitemap file. One is "visible" for those items I do not wish to be shown in the menu as a direct navigation link so I set the Visible property to "false". The other is "type" which I use to define an item as a "root" item. Here I set the NavigateUrl to "#" so it will not navigate to anything. I set the SelectedCssClass and FocusedCssClass to "" so that if a user clicks the item it does not apply any of the styles to it. However it will still allow the items to apply the correct style if a child item is selected.
Hope that helps anyone else looking to so the same.