473,856 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7153
is this an ASP:xxx control or a HTML control?
Aspx = ... enabled=true/false.....
Html = ...disabled=tru e/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.goo gle.com...
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:linkbutt on id="btnHome" runat="server" causesvalidatio n="False"
cssclass="toolb ar">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:linkbutt on id="btnHome" runat="server" causesvalidatio n="False"
cssclass="toolb ar" borderwidth="2p x">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_da rkfalz.com> wrote in message news:<ei******* *******@tk2msft ngp13.phx.gbl>. ..
is this an ASP:xxx control or a HTML control?
Aspx = ... enabled=true/false.....
Html = ...disabled=tru e/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.goo gle.com...
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
32279
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? Thanks, Chris Ullman
21
9935
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
2485
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 when the submit button is pressed? I am designing a PayPal order page that will have 4 items, each with a 3-character text box where the customer will enter quantity. The default value will be "0." I want to be able to test whether the
21
4013
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 nothing in IE. I'd be greatful for any assistance. Also, if I will have problems the code on Opera or Safari, I'd appreciate any pointers--I don't have a Mac to test Safari. THanks very much, Michael
1
25838
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 possible of is disabled not to be set in style?
1
4390
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: bold; font-size: 16pt; text-transform: uppercase; color: white;
2
9082
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" onClick="hideOrShowDivById('emailList133156'); return false;">See emails?</a>)</p> <form method="post" action="mcControlPanel.php" id="emailList133156" style="display:none;"><textarea name="formInputs">nazjeehaj@son.org,
1
6523
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" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
3
52252
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: 8px">One</option> <option style="font-family: Tahoma; font-size: 10px">Two</option> <option style="font-family: Verdana; font-size: 12px">Three</option> </select> I see that I can change the color using style="color: whatever", but
0
9923
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9767
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11081
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10709
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10806
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10394
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9544
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7104
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
3214
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.