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

Selected Item does not change color

1 Answer 52 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Gotcha
Top achievements
Rank 1
Gotcha asked on 03 Sep 2011, 06:32 PM
Hi,
 
I have defined a RadMenu in a Master Page which loads its content from an XML.
When I login from a Default.aspx, if successful login it loads the Savings Page ; SC.aspx which is called within this MasterPage.
My problem is that :
1. the Savings Item on the RadMenu is not "hilighted" - a state to show that the current page is the "Savings" page (something i saw in the various demo). I expect to see the current page to be "hilighted".
2. When i click on another Page on the Menu, it navigates to the other page and again the Clicked Menu is not hilighted after it's loaded.

How can i achieve the hilighted items if i'm on the page?

Thanks for your help

<telerik:RadMenu ID="rmMainNav" runat="server" Skin="GMSkin" EnableEmbeddedSkins="false"  DataSourceID="dsMainNavXML"
     DataTextField="title" DataNavigateUrlField="url" DataValueField="title" OnItemClick="RadMenu_ItemClick"
     Width="100%">
 </telerik:RadMenu>

<?xml version="1.0" encoding="utf-8" ?>
<menu>
  <item url="#" title="   "  description="   " />
  <item url="../Pages/SC.aspx" title="Savings"  description="Savings" />
  <item url="../Pages/SL.aspx" title="Shopping"  description="Shopping" />
  <item url="../Pages/BI.aspx" title="Items"  description="Items" />
  <item url="../Pages/FD.aspx" title="Deals"  description="Deals" />
  <item url="../Pages/MP.aspx" title="Profile"  description="Profile" />
</menu>

1 Answer, 1 is accepted

Sort by
0
Gotcha
Top achievements
Rank 1
answered on 04 Sep 2011, 03:38 AM
Nevermind... replying to my own thread...

Instead of using the XMLDataSource to load the RadMenu and loaded XML on page load of the Master Page... and used a snippet i found on this forum.. to set the CSS of the selected item to "rmFocused"
if (!IsPostBack)
{
    rmMainNav.LoadContentFile("../Pages/MainNavigation.xml");
}
 
 
RadMenuItem item = rmMainNav.FindItemByUrl(Request.Url.PathAndQuery);
if (item != null)
{
 
    foreach (RadMenuItem childItem in item.Menu.GetAllItems())
    {
        childItem.CssClass = "";
    }
 
    item.CssClass = "rmFocused";

Tags
Menu
Asked by
Gotcha
Top achievements
Rank 1
Answers by
Gotcha
Top achievements
Rank 1
Share this question
or