Asp:Menu after disabled looks like Active

Sudhanshum
Sudhanshum used Ask the Experts™
on
Hi I am using asp.net application and I am using asp:menu. At one point I am disabling menu but on IE11 and chrome It still looks like active(It's not clickable but color looks same), I tried to change menu color from codebehind but when It switch back to that menu as enabled then it doesn't work properly,How I can fix this problem?

Regards,
Sudhanshu
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2014
Commented:
The active MenuItem should be an <a> element with a href attribute, and the inactive one an <a> element without href.
You can control how they are displayed by setting the style for the <a> element and a different style for a:link
a {
    color: green
}
a:link {
    color: red
}

Open in new window

Author

Commented:
Can you please elaborate more. How can i use this a tag in Code behind code using Menu Item only. Because when my Link is enable false i want different color and when it enable true at that time i want different color.

I had also use this code:
when enable false : M1Menu.FindItem("ACC").Text = "<div style='color: #a3a3a3'>" + M1Menu.FindItem("ACC").Text + "</div>"

when enable true:  M1Menu.FindItem("ACC").Text = "<div style='color: #284E98'>" + M1Menu.FindItem("ACC").Text + "</div>"

But When i refresh my page, it is not working properly.
Top Expert 2014
Commented:
You enable or disable the MenuItem by setting its Enabled property to true or false and let css do the color changing.
Top Expert 2014

Commented:
I provided an answer. I don't know if it has been understood and tested.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial