Menu Active Page

8 posts, 0 answers
  1. MissioDei
    MissioDei avatar
    17 posts
    Member since:
    Aug 2008

    Posted 01 Nov 2010 Link to this post

    I'm using the default skin for rad menu.

    For each menu item I have specified a:

    HoveredImageUrl
    ImageURL
    ClickedImageURL

    I also have an image I would like to use when the user has clicked a menu item and browsed to the corresponding menu item page. ClickedImageURL swaps the image when I click, how do I keep this image active when the user hits the new page?

    Thanks in advance.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Nov 2010 Link to this post

    Hi,


    If you want to show/persist the image for item after selecting the item, then you could set the SelectedImageUrl instead of ClickedImageUrl.


    -Shinu.
  3. MissioDei
    MissioDei avatar
    17 posts
    Member since:
    Aug 2008

    Posted 02 Nov 2010 Link to this post

    Yeah I should have included that in my original post, but I tried that as well and it does not work. I currently have the menu in a master page and I'm wondering if it is not showing the selected image because of this. Is there some additional step I need to take in order to get my selectedimage to show the menu graphic I want to use when they are on the corresponding page?

    Thanks for any guidance.
  4. Yana
    Admin
    Yana avatar
    5002 posts

    Posted 04 Nov 2010 Link to this post

    Hello Strategon,

    I guess that the items have NavigateUrl set - in this case the page navigates and a new page with a different instance of the menu is opened - that's why the selected state is not preserved. You can find the clicked menu item using its NavigateUrl and set its Selected property to true like this:

    RadMenuItem currentItem = RadMenu1.FindItemByUrl(Request.Url.PathAndQuery);
    currentItem.Selected = true;


    All the best,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 17 Jan 2011 Link to this post

    Dear Yana

    I also use NavigateURL and tried your approch.

    currentItem.Selected trows an error "selected is not a member of telerik.web.ui.radmenuitem

    Any idea?

    Markus
  6. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 17 Jan 2011 Link to this post

    I kind of got it working using this code

    Protected Sub RadMenu1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMenuEventArgs) Handles RadMenu1.ItemDataBound
            Dim element As XmlElement = DirectCast(e.Item.DataItem, XmlElement)
      
            If Not element.Attributes("Text") Is Nothing Then
                e.Item.Text = element.Attributes("Text").Value
            Else
                e.Item.Visible = False
            End If
            If Not element.Attributes("NavigateURL") Is Nothing Then
                e.Item.NavigateUrl = element.Attributes("NavigateURL").Value
            End If
            If Not element.Attributes("LookId") Is Nothing Then
                e.Item.Value = element.Attributes("LookId").Value
            End If
      
            Dim item As RadMenuItem = RadMenu1.FindItemByUrl(Request.Url.PathAndQuery)
            If item IsNot Nothing Then
                item.CssClass = "rmFocused"
                item.HighlightPath()
            End If
      
        End Sub

    As you can see i used

    item.CssClass = "rmFocused" which acutally does show the focused state of the skind.

    Howerver item.highlightPath() does nothing. anything else I have to do to get that working?

    Markus
  7. Yana
    Admin
    Yana avatar
    5002 posts

    Posted 17 Jan 2011 Link to this post

    Hi Markus,

    I guess that you're using an older version of the controls, that's why Selected property is not available. Setting "rmFocused" class is the right way in your case.

    Kind regards,
    Yana
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  8. Markus
    Markus avatar
    205 posts
    Member since:
    Nov 2005

    Posted 17 Jan 2011 Link to this post

    Dear Yana

    It works now. rmFocused was not sedt for to level menu in custom skin css.

    Regards Markus
Back to Top