473,419 Members | 4,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Setting Style of Disabled Item on Web Form

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.
Nov 18 '05 #1
2 7095
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.

Nov 18 '05 #2
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.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chris Ullman | last post by:
Simply put - if I have a disabled textbox how could I change the font-color from gray? e.g. <input type="text" disabled></input> Color no longer seems to work. Can it be done and if so how? ...
21
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
5
by: Mark Hannon | last post by:
I have been researching the "disabled" property for form data and wanted to know: - Does the disabled property supress the form item from being submitted? - Can the disabled property be applied...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
1
by: Martin | last post by:
Is disabled to be set in the style of a tag just like visible? I am trying to set the whole content of a td tag to disabled like this, style='disabled:true' and it does not seem to work. Is this...
1
by: Mervin Williams | last post by:
I am having a problem setting the CSSClass property of a my Label control. I set CSSClass property, but its not taking the font style settings. Here is my style: ..TabText { font-weight:...
2
by: Jake Barnes | last post by:
Imagine I've this block of HTML: <p>Alex Schein Mailing List <input type="checkbox" name="newslettersToUse" value="133156"> (<a href="mcControlPanel.php"...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
3
by: Jason Carlton | last post by:
Is there a way to change the font-family and font-size for each individual option in a select menu? Something along the lines of: <select size="1"> <option style="font-family: Arial; font-size:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.