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

Highlighting parent of selected menu item

3 Answers 143 Views
Menu
This is a migrated thread and some comments may be shown as answers.
andieje
Top achievements
Rank 1
andieje asked on 10 Mar 2008, 05:07 PM
Hi

Lets say i have a simple menu with only one level of items, I am highlighting the menu item corresponding to the page the user is viewing like so

Dim menuItem As RadMenuItem = MainMenu.FindItemByUrl(Request.Url.PathAndQuery)

If Not (menuItem Is Nothing) Then

menuItem.CssClass =

"rmFocused"

 

End If 

My menu has now changed to have child items

e.g
Parent1
  Child1
  Child2
Parent 2
Parent 3
Parent 4
  Child 3
  Child 4

If the user selects the menu item called Child 1, i want its parent menu item Parent1 to be highlighted when the page loads to show the user is in that 'section' of the menu. I dont know how to do this

thanks
andrea

3 Answers, 1 is accepted

Sort by
0
andieje
Top achievements
Rank 1
answered on 20 Mar 2008, 12:33 PM
Hi

I would be very grateful if someone could look at this question as it was posted 10 days ago

thanks
0
andieje
Top achievements
Rank 1
answered on 20 Mar 2008, 12:33 PM
Hi

Please could you look at this question as it was posted 10 days ago

many thanks
0
Veselin Vasilev
Telerik team
answered on 20 Mar 2008, 01:37 PM
Hi andieje,

I apologize for the delayed reply.

You can try this code:

Dim menuItem As RadMenuItem = MainMenu.FindItemByUrl(Request.Url.PathAndQuery) 
 
If Not (menuItem Is NothingThen 
menuItem.CssClass = "rmFocused" 
(DirectCast(menuItem.Owner, RadTreeNode)).CssClass = "rmFocused" 
End If  

I hope this helps.

Regards,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Menu
Asked by
andieje
Top achievements
Rank 1
Answers by
andieje
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or