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

Keep current menu item selected

1 Answer 84 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 11 Dec 2008, 02:28 PM
Hi,

Can anyone tell me if there is a simple solution to this problem?
When I click a menu item (horizontal menu) or one of it's children, I must have the current menu item highlighted like when I hover over the item, but then fixed. If I click another item this item must get highlighted.

How can this be done?

Thanks in advance,
Frank 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Dec 2008, 01:56 PM
Hello Frank,

Check out the following code to get The required scenario.
cs:
protected void RadMenu1_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e) 
    {         
        if(e.Item is RadMenuItem) 
        { 
            string strtxt = e.Item.Text;             
            e.Item.BackColor = System.Drawing.Color.Red; 
            foreach (RadMenuItem item in RadMenu1.Items) 
            { 
                if (item.Text != strtxt) 
                    item.BackColor = System.Drawing.Color.Empty; 
                foreach (RadMenuItem item2 in item.Items) 
                { 
                    if (item2.Text != strtxt) 
                        item2.BackColor = System.Drawing.Color.Empty; 
                } 
            }             
        }  
    }

Thanks
Princy.


Tags
Menu
Asked by
Frank
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or