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

Changing the style of active menu

3 Answers 144 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Gita
Top achievements
Rank 1
Gita asked on 22 Dec 2008, 07:16 PM
How can I change the font-color of an active menu item? Which .rm class is it?

Thanks

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Dec 2008, 06:01 AM
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.
0
Gita
Top achievements
Rank 1
answered on 23 Dec 2008, 07:19 AM
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.

0
Princy
Top achievements
Rank 2
answered on 30 Dec 2008, 12:51 PM
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.
Tags
Menu
Asked by
Gita
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Gita
Top achievements
Rank 1
Share this question
or