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

[Solved] Selected Menu...

1 Answer 108 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Dharmesh Barochia
Top achievements
Rank 1
Dharmesh Barochia asked on 18 Jun 2009, 06:18 AM

Dear Sir,

I am using sitemap file to fill up RadMenu, it has only top level Image menu, no any subMenu.

To display image I have written following code inside ItemDataBound.

protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)

{

   SiteMapNode node = e.Item.DataItem as SiteMapNode;

   e.Item.ImageUrl = node["CustomImageURL"];

   e.Item.HoveredImageUrl = node["HoverImageURL"];

}

 

In above code I have written to display imageUrl and MouseHourImage.

 

Now I want selected menu should have different image therefore I need selected menu index or name.

 

RadMenu contain ItemClick event but this event will be execute at the time of sub menu clicked.

 

When I check “sender” object parameter in QuickWatch I found that following line return selected page url .

 

((Telerik.Web.UI.HierarchicalControlItemContainer)(sender)).CurrentSiteMapUrl

 

But when I try to write in code it gives me compilation error that “The property or indexer 'Telerik.Web.UI.HierarchicalControlItemContainer.CurrentSiteMapUrl' cannot be used in this context because the get accessor is inaccessible.”

I want to know that, is there any another way to display Selected image in RadMenu?

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 18 Jun 2009, 03:39 PM
Hello Dharmesh Barochia,

RadMenu uses the following code to determine the current url:

    IHierarchyData currentNode = siteMap.Provider.CurrentNode;
    if (currentNode != null)
              CurrentSiteMapUrl = currentNode.Path;

You can use the same as well.

I hope this helps,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Menu
Asked by
Dharmesh Barochia
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or