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

Menu Active Page

7 Answers 97 Views
Menu
This is a migrated thread and some comments may be shown as answers.
MissioDei
Top achievements
Rank 1
MissioDei asked on 01 Nov 2010, 03:42 PM
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.

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Nov 2010, 10:56 AM
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.
0
MissioDei
Top achievements
Rank 1
answered on 02 Nov 2010, 01:37 PM
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.
0
Yana
Telerik team
answered on 04 Nov 2010, 02:18 PM
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
0
Markus
Top achievements
Rank 2
answered on 17 Jan 2011, 10:20 AM
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
0
Markus
Top achievements
Rank 2
answered on 17 Jan 2011, 10:29 AM

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
0
Yana
Telerik team
answered on 17 Jan 2011, 04:52 PM
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.
0
Markus
Top achievements
Rank 2
answered on 17 Jan 2011, 04:57 PM
Dear Yana

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

Regards Markus
Tags
Menu
Asked by
MissioDei
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
MissioDei
Top achievements
Rank 1
Yana
Telerik team
Markus
Top achievements
Rank 2
Share this question
or