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

current selected menu value

1 Answer 61 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Jai
Top achievements
Rank 1
Jai asked on 31 May 2011, 09:53 AM
Hi,

I want to change the font color of selected Menu when it clicked. I tried to do it in Menu css but what is happening is, When we click on any menu there is page load and it reloads a full page and in that case the css again reload with page. So I thought to change font color of selected menu in C# code in Page_Load. But I am getting null for the selectedItem everytime after selection of any menu
Can you please let me know that how to do that change font color of selected menu ?

Note: I don't have any submenu in my menu control.


Thanks,
--JP

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 31 May 2011, 01:30 PM
Hello Jai,
Try setting the font color by accessing menu item in ItemClick event.

C#:
protected void menu_ItemClick(object sender, RadMenuEventArgs e)
    {
        RadMenuItem selectItem = (RadMenuItem)e.Item;
        foreach (RadMenuItem item in menu.GetAllItems())
        {
            if (selectItem == item)
            {
                item.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                item.ForeColor = System.Drawing.Color.Black;
            }
        
    }

Thanks,
Princy.
Tags
Menu
Asked by
Jai
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or