Highlighting parent of selected menu item

4 posts, 0 answers
  1. andieje
    andieje avatar
    473 posts
    Member since:
    Oct 2006

    Posted 10 Mar 2008 Link to this post

    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

  2. andieje
    andieje avatar
    473 posts
    Member since:
    Oct 2006

    Posted 20 Mar 2008 Link to this post

    Hi

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

    thanks
  3. andieje
    andieje avatar
    473 posts
    Member since:
    Oct 2006

    Posted 20 Mar 2008 Link to this post

    Hi

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

    many thanks
  4. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 20 Mar 2008 Link to this post

    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
Back to Top