Css & Asp: button conflict

I am working on a webpage and at some point I need to disable the asp: button.

This page uses a css file that has the following class:

.pagerLinkDisabled
{
    display: none;
}

      

So every time I set a button to disable .net it displays it with class="pagerLinkDisabled"

and the button is not displayed ...

In pageload, I tried this:

myButton.Enabled=false;
myButton.Style.Add("display","static");

      

How can I get around this problem without changing the css file?

Thanks:)

Edit

To clarify:

  • The button is visible, but if the parameter is set to false, the framework adds class = "pagerLinkDisabled" to the input tag.

  • This class is defined in the css file, which I cannot change.

Edit2:

My button is defined as such:

<asp:Button runat="server" ID="myButton" Text="mytext" Enabled="false" />

      

The rendered html:

<input type="submit" name="ctl00$ContentPlaceHolder$ctl00$myButton" value="mytext" id="ctl00_ContentPlaceHolder_ctl00_myButton" class="pagerLinkDisabled" />

      

0


a source to share


5 answers


Can't you just edit the HTML Source so that the button doesn't use this class?



Or is it defined at a higher level within HTML? for example In the BODY tag.

+1


a source


I'm not sure, but trying to load pages:



myButton.Visible = true;

      

+2


a source


Why not just change the class name on the button?

+1


a source


Have you tried something like this:

myButton.Attributes.Add("Style","display:block !important");

      

+1


a source


Edit . This works for me.

myButton.Style["display"] = "block !important";
myButton.Style["disabled"] = "disabled";

      

+1


a source







All Articles