change menu item

4 posts, 1 answers
  1. Susan
    Susan avatar
    137 posts
    Member since:
    Jul 2007

    Posted 14 Jun 2009 Link to this post

    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

     

  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 16 Jun 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Susan
    Susan avatar
    137 posts
    Member since:
    Jul 2007

    Posted 16 Jun 2009 Link to this post

    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
  5. Answer
    Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 17 Jun 2009 Link to this post

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