Asp:Menu after disabled looks like Active

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
SudhanshumAsked:
Who is Participating?
 
louisfrCommented:
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

0
 
SudhanshumAuthor 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.
0
 
louisfrCommented:
You enable or disable the MenuItem by setting its Enabled property to true or false and let css do the color changing.
0
 
louisfrCommented:
I provided an answer. I don't know if it has been understood and tested.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.