It's an asp:linkbutton. In the HTML it looks like this:
<asp:linkbutton id="btnHome" runat="server" causesvalidation="False"
cssclass="toolbar">Home</asp:linkbutton>
The "toolbar" style is defined in a linked CSS:
..toolbar
{
font-family: Arial,Helvetica,sans-serif;
font-size: 8pt;
text-decoration: none;
text-align: center;
color: Blue;
background-color: Silver;
border-color: Gray;
border-style: ridge;
border-width: 2px;
width: 54px;
height: 19px;
}
In the codebehind page, I set it to disabled on a PostBack thusly:
btnHome.Enabled = false;
When I get the page back, all the stylesheet formatting is gone,
including the size, colors, and borders.
The .toolbar[disabled] syntax doesn't work.
Interesting observation - if I inline AT LEAST ONE of the style
elements, it uses it PLUS the stylesheet elements even for the
disabled state:
<asp:linkbutton id="btnHome" runat="server" causesvalidation="False"
cssclass="toolbar" borderwidth="2px">Home</asp:linkbutton>
This then keeps the border AND all of the stuff in the stylesheet -
only the actual text is grayed out. It's an OK workaround, but I
really like my styles to be all defined through the stylesheets.
John H.
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message news:<ei**************@tk2msftngp13.phx.gbl>...
is this an ASP:xxx control or a HTML control?
Aspx = ... enabled=true/false.....
Html = ...disabled=true/false....
Show how you are doing it now
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Kubuli John" <jo**@haasbeek.com> wrote in message
news:6e**************************@posting.google.c om... I have a LinkButton in an ASP.NET web form. Depending on the current
state of affairs, I either enable or disable the link button in by
code-behind class (e.g., disable the "Previous" button if you are
already at the first record). I have constructed a very nice style
for the button in my stylesheet, but the style is ignored when I
disable the button.
So, how do I control the display attributes of a disabled HTML widget?
Thanks...
John H.