473,670 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c#: How to change the Back color of the Disabled TextBox control

40 New Member
hi
I am using Textbox contrl which is disabled for some conditions.
I would like to make the Textboxes back color as white as it looks when it is enabled? Can u pls help how to change its back color?


Thank u
Dec 19 '07 #1
4 28980
debasisdas
8,127 Recognized Expert Expert
Once you enable the textbox its back color will automatically changed to default white.
Dec 19 '07 #2
ssknov
40 New Member
hi das
sorry my question was wrong,
though it was disabled it should be in white color?

now i did it thanku.

for others following code may help

this.txtUserNam e.BackColor = System.Drawing. SystemColors.Co ntrolLightLight ;

cheers
kssk
Dec 19 '07 #3
ilyaostr
1 New Member
Couldn't you just set it's ReadOnly property to true?
Sep 30 '08 #4
Plater
7,872 Recognized Expert Expert
If this is a windows application, just set the background color like normal and it works:
Expand|Select|Wrap|Line Numbers
  1. tbinput.Enabled = false;
  2. tbinput.BackColor = Color.Red;
  3.  
If it is a web application, changes it's style element's backgroundcolor
Oct 1 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
4479
by: Mantorok | last post by:
Hi all Is it possible to disable a Control in .Net but have the text colour always in black? I would rather use Enabled property rather than Readonly as it does everything I need it to in one swoop (no tabstop, no focus etc.). Any ideas?
5
6927
by: Robert Phillips | last post by:
I have a Panel control containing a few TextBox controls. The Panel is originally enabled, I enter data into the TextBox controls. When I submit, the Panel is disabled during the PostBack and the TextBox controls render greyed-out, and I can see the values in the TextBox controls....this is what I expected. I submit again, the Panel is enabled during the PostBack. All of the TextBox controls within the Panel are now enabled, however,...
3
4487
by: Marc Castrechini | last post by:
I have a page that changes an <ASP:Checkbox value based on a user entered value in a textboxm using client side Javascript. After my submit is fired the value for the chkMyCB.checked does not get the latest value of the checkbox. Does this sound like a posibility and if so how can I force the server to get the new value from the page? TIA,
1
2825
by: jboldrick | last post by:
I'm using Access 2003. I seem to have suddenly lost the ability to set the Back Style property of tab controls to "Transparent." Or rather, I can set the property value as "Transparent" but nothing happens; the control looks the same as if the property were set to "Normal." Existing controls set to Transparent are still OK; I just can't make the new ones transparent. Does anybody have any idea what's up? Many thanks for any input. ...
3
1645
by: david | last post by:
I have written JavaScript and try to change the radio button property (disenable other radio buttons) once click on it. But it does not work. For example, I have radio buttons A, B, and C. A and B are in the same group AB. When A is selected, C is enabled; otherwise, C is disabled. MY code is: JavaScript: function enableC(){ document.Form1.C.enabled = true; }
4
10410
by: Matrixreloadedth | last post by:
How to change disable color of Checkbox??? I have a checkbox with forecolor in red but when i disable by set Enable properties to false forecolor is changed to gray color but i don't want it. how to make disable color as the same before set enable = false Anyone can help me?????
2
1706
by: sonic | last post by:
I realize that if a field is disabled, its value will not be posted to server. i realize that .Enabled = false, produces disabled="disabled" markup i still don't see a good way to disable a field using javascript and than check for that on the server. if i render a regular textbox <asp:Textbox id="txt" runat="server" /> than on client do:
4
8596
by: Bob | last post by:
Hi, Is it possible to change the forecolor of a disabled text control. I have a RichText Box that I don't want the user to edit but the Grey on Grey default is hard to read. Is there a way of overriding this with a custom colour? I had a quick foray into the forms Paint event handler but no joy. Thanks Bob
7
11796
by: garyusenet | last post by:
I'm using krypton toolkit which has allowed me to make a cool looking form. However, when I set my textbox to disabled it is 'greyed' out. The grey colour isn't in keeping with the office 2007 style look of my form. How can i change the colour that control assumed when it's disabled? Thanks! Gary-
0
8469
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
8386
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
8903
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...
1
8592
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
8661
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
7419
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
5684
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();...
2
2042
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1794
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.