Changing the style of active menu

4 posts, 0 answers
  1. Gita
    Gita avatar
    10 posts
    Member since:
    Nov 2008

    Posted 22 Dec 2008 Link to this post

    How can I change the font-color of an active menu item? Which .rm class is it?

    Thanks
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Dec 2008 Link to this post

    Hi Gita,

    You can change the font-color of RadMenuItems by editing the CSS class .rmText or from server side code.

    By adding the CSS:
    <style type="text/css">      
    .RadMenu_Default .rmText  
    {  
        color:Green !important;  
    }  
    </style> 

    From code behind:
    RadMenu1.FindItemByText("RadMenuItem1").ForeColor = System.Drawing.Color.Green;

    Thanks,
    Princy.
  3. Gita
    Gita avatar
    10 posts
    Member since:
    Nov 2008

    Posted 23 Dec 2008 Link to this post

    Hello Princy and thanks for the reply.

    It changed the color of ALL Menu items to green. What I need is changing the color of the active menu. For example if all the menus are white, when the client hits the "Services" link and is on the Services page, the color of the menu services to be other than the rest of menu items, lets say to be blue. This is what I meant by active menu (maybe the wrong expression).

    Thanks
    PS. What about cursor? Once I chnage the cursor: auto, this ist a hand on IE and a Text in Mozilla :(

    .RadMenu

    .rmRootGroup .rmLink:hover,

     

     

    .RadMenu

    .rmRootGroup .rmFocused,

     

     

    .RadMenu

    .rmRootGroup .rmExpanded

     

     

    {

     

    background: transparent;

     

     

     

    color: #4f9df3;

     

     

     

    cursor: auto;

     

    }

    PPS: this is a DNN application. The CSS is on the root directory and it works without giving the .RadMenu a specific name.

  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Dec 2008 Link to this post

    Hello Gita,

    You can set the forecolor of the active menu item in the code behind as shown below:
    cs:
     protected void RadMenu1_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e) 
        { 
             
            if(e.Item is RadMenuItem) 
            { 
                string strtxt = e.Item.Text; 
                e.Item.ForeColor = System.Drawing.Color.Red; 
                foreach (RadMenuItem item in RadMenu1.Items) 
                { 
                    if (item.Text != strtxt) 
                        item.ForeColor = System.Drawing.Color.Empty; 
                    foreach (RadMenuItem item2 in item.Items) 
                    { 
                        if (item2.Text != strtxt) 
                            item2.ForeColor = System.Drawing.Color.Empty; 
                    } 
                } 
                 
            }        
        }  
     
    Hope this helps.

    Thanks
    Princy.
Back to Top