Why are linkbuttons not grayed out when disabled in FireFox?

后端 未结 5 1709
星月不相逢
星月不相逢 2021-02-06 02:39

Why when I set enabled=false on a button does it not render correctly in Firefox? Instead of graying out the link it is still blue.

[UPDATE]

ASP.net already rem

相关标签:
5条回答
  • 2021-02-06 02:50

    In C#, I found that an extension is the most helpful to create a cross-browser solution.

    public static class Extensions
    {
        public static void Disable(this HtmlAnchor obj)
        {
            obj.Attributes.Remove("href");
            obj.Attributes.Add("disabled", "true");
            obj.Style.Add("color", "gray");
        }
    }
    
    0 讨论(0)
  • 2021-02-06 03:05
    a[disabled]
    {
       color:Grey; text-decoration:none;
    }
    

    worked for me, Thank you...

    0 讨论(0)
  • 2021-02-06 03:08

    When you disable a button it adds "aspNetDisabled" class to the button. so you can easily set the "aspNetDisabled" class with whatever you want.

     .aspNetDisabled {
            color: black;
            background-color: #e3e3e3;
            text-decoration: none;
        }
    
    0 讨论(0)
  • 2021-02-06 03:11

    The solution below is for buttons not link but it can be done for link as well.

    var obj = document.getElementById('buttonId'');
    getLabel = function(elem){
    if (elem.id && elem.id=="label") {
    elem.id = "disabledLabel";
    }
    };            
    Dom.getElementsBy(getLabel ,'td', obj);
    

    This will show button as disable or grayed out.

    0 讨论(0)
  • 2021-02-06 03:12

    From W3Scholl, "Enabled" Property isn't standard property of XHTML 4(It's Microsoft standard.). You should remove href property from hyperlink or using my following code

    // cancel click event.
    LinkButton1.Attributes["OnClick"] = "return false;";
    // set css to display same disabled link in all browser
    LinkButton1.CssClass = "LinkButton_Disabled";
    
    0 讨论(0)
提交回复
热议问题