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

change menu item

3 Answers 87 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Susan
Top achievements
Rank 1
Susan asked on 14 Jun 2009, 04:56 PM
i have looked thru a number of posts, tried a lot of different things, and cannot get this to work. When I click on a menu item (say from the home page), it navigates to the selected screen. From that page, I want to change the background color of the menu item. I cannot do it from the .aspx using the cssclass, as one screen contains 2 menu items (for example, one screen on my website contains both 'Forms' and 'Links'). When 'Forms' is click, I want to highlight it in the menu and same for 'Links'. They both go to the same page.
I have tried both the following, but neither work. They are in my Page_Load.

 

<style type="text/css">

 

 

.selectedItem {

 

 

background-color: #FFD92F !important;

 

 

color: #000000 !important;

 

}

 

.rmItem { border-right: 1px solid white; }

 

 

.rmItem { border-top: 1px solid #7F8ECB; }

 

 

 

</style>

 




radmenu1.items(11).cssclass='SelectedItem'

AND 

 

Dim currentItem as Telerik.Web.UI.RadMenuItem

 

currentItem = radMenu1.FindItemByText(

"Forms")

 

currentItem.CssClass=

"SelectedItem"

Thanks,
Susan Pelzel

 

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 16 Jun 2009, 04:08 PM
Hi Susan,

If I understand you correctly, you need to implement show path functionality. Please, review this demo and let us know if it helped you:
http://demos.telerik.com/aspnet-ajax/menu/examples/programming/showpath/defaultcs.aspx?Page=Telerik%20Trainer


Greetings,
Peter
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.
0
Susan
Top achievements
Rank 1
answered on 16 Jun 2009, 06:44 PM
Sorry, I was not very clear. I have a very simple menu as below:

                             <telerik:RadMenu ID="RadMenu1" runat="server" Flow=Vertical BackColor="#212844">
                                <Items>
                                    <telerik:RadMenuItem Text="Home" NavigateUrl="default.aspx" CssClass="selectedItem"/>
                                    <telerik:RadMenuItem Text="Rec League" NavigateUrl="#"/>
                                    <telerik:RadMenuItem Text="Adult League" NavigateUrl="#"/>
                                    <telerik:RadMenuItem Text="Tryouts" NavigateUrl="Tryouts.aspx"/>
                                    <telerik:RadMenuItem Text="Calendar" NavigateUrl="GJSCCalendar.aspx"/>
                                    <telerik:RadMenuItem Text="Tournaments/Training" NavigateUrl="Training.aspx"/>
                                    <telerik:RadMenuItem Text="Club Info/Contacts" NavigateUrl="ContactUs.aspx"/>
                                    <telerik:RadMenuItem Text="Coaches" NavigateUrl="Coaches.aspx"/>
                                    <telerik:RadMenuItem Text="News" NavigateUrl="News.aspx"/>
                                    <telerik:RadMenuItem Text="Photo Gallery" NavigateUrl="PhotoGallery.aspx"/>
                                    <telerik:RadMenuItem Text="Forms" NavigateUrl="Forms.aspx"/>
                                    <telerik:RadMenuItem Text="Links" NavigateUrl="Forms.aspx"/>
                                    <telerik:RadMenuItem Text="Sponsors" NavigateUrl="Sponsors.aspx"/>
                                    <telerik:RadMenuItem Text="Feedback" NavigateUrl="Feedback.aspx"/>
                                    <telerik:RadMenuItem Text="Donations" NavigateUrl="Donations.aspx"/>

                                </Items>
                            </telerik:RadMenu>

The 'Forms' and 'Links' go to the same page Forms.aspx. When I get to the 'Forms.aspx' page, I either want to highlight the 'Forms' menu item (if that is what they clicked) or the 'Links' menu item (if that is what they clicked). I can determine which one they clicked, I just need to know how to set the background color to a different color so that menu item is 'highlighted'.

If I do the following in the .aspx page, it works. I just need to do it in the code-behind.

<telerik:RadMenuItem Text="Links" NavigateUrl="Forms.aspx" cssclass="selectedItem"/>

Thanks,
Susan
0
Accepted
Atanas Korchev
Telerik team
answered on 17 Jun 2009, 04:09 PM
Hello Susan,

You can use the HighlightPath method of the menu item once you find it.

All the best,
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
Susan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Susan
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or