473,322 Members | 1,778 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,322 software developers and data experts.

TextBox.BackColor code compiles, but doesn't do anything.

It's curious. In my page the code ...
TextBox t = (TextBox)Page.FindControl(mycontrol);
if (!(t==null))
{
t.Visible = false;
}

....will hide the control. But the code...
TextBox t = (TextBox)Page.FindControl(mycontrol);
if (!(t==null))
{
t.BackColor = System.Drawing.Color.DarkRed;
}
....won't change the color.

I'd sure appreciate any tips on how to fix this behavior!

Thanks!

--Brent
Nov 17 '05 #1
4 6645
What is the value in t.BackColor in intellisense while debugging

-------
Regards ,
C#, VB.NET , SQL SERVER , UML , DESIGN Patterns Interview question book
http://www.geocities.com/dotnetinterviews/
My Interview Blog
http://spaces.msn.com/members/dotnetinterviews/

Nov 17 '05 #2
sh**********@yahoo.com wrote:
What is the value in t.BackColor in intellisense while debugging

-------
Regards ,
C#, VB.NET , SQL SERVER , UML , DESIGN Patterns Interview question book
http://www.geocities.com/dotnetinterviews/
My Interview Blog
http://spaces.msn.com/members/dotnetinterviews/

Oh...I wouldn't be able to tell! All I've got in this coding environment
is a text editor...

Thanks for your reply!

--Brent
Nov 17 '05 #3
Hi,

CSS can prevent it. check the html generated and see what you get there.
From MSDN:
Use the BackColor property to specify the background color of the Web server
control. This property is set using a System.Drawing.Color object.

Note This property will render for only certain controls. For example,
Table, Panel, DataGrid, Calendar, and ValidationSummary will render this
property. It will also work for CheckBoxList, RadioButtonList and DataList
if their RepeatLayout property is RepeatLayout.Table, not RepeatLayout.Flow.
In general, only controls that render as a <table> tag can display a
background color in HTML 3.2, whereas almost any control can in HTML 4.0.

For controls that render as a <span> tag (including Label, all validation
controls, and list controls with their RepeatLayout property set to
RepeatLayout.Flow), this property will work in Microsoft Internet Explorer
version 5 and later, but not in Microsoft Internet Explorer version 4.
You better use CSS.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Brent" <"writeBrent at the google mail place"> wrote in message
news:11************@corp.supernews.com...
It's curious. In my page the code ...
TextBox t = (TextBox)Page.FindControl(mycontrol);
if (!(t==null))
{
t.Visible = false;
}

...will hide the control. But the code...
TextBox t = (TextBox)Page.FindControl(mycontrol);
if (!(t==null))
{
t.BackColor = System.Drawing.Color.DarkRed;
}
...won't change the color.

I'd sure appreciate any tips on how to fix this behavior!

Thanks!

--Brent

Nov 17 '05 #4
Thanks, Ignacio...I think it's back to the drawing board for me here!

--Brent

Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

CSS can prevent it. check the html generated and see what you get there.
From MSDN:
Use the BackColor property to specify the background color of the Web server
control. This property is set using a System.Drawing.Color object.

Note This property will render for only certain controls. For example,
Table, Panel, DataGrid, Calendar, and ValidationSummary will render this
property. It will also work for CheckBoxList, RadioButtonList and DataList
if their RepeatLayout property is RepeatLayout.Table, not RepeatLayout.Flow.
In general, only controls that render as a <table> tag can display a
background color in HTML 3.2, whereas almost any control can in HTML 4.0.

For controls that render as a <span> tag (including Label, all validation
controls, and list controls with their RepeatLayout property set to
RepeatLayout.Flow), this property will work in Microsoft Internet Explorer
version 5 and later, but not in Microsoft Internet Explorer version 4.
You better use CSS.

cheers,

Nov 17 '05 #5

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

Similar topics

11
by: Mr. B | last post by:
While at first this may seem a simple tast, it has plagued me for a while... What I want to do is to have the background colour of something like a TextBox to change from (say) White to Yellow to...
4
by: Jurjen de Groot | last post by:
I'm developing a ASP.NET/VB.NET web application. (VS.NET 2003) I've created several webpages, but on two pages one textbox colors yellow (the background) and I can't get the background to appear...
12
by: Henry Jones | last post by:
I have a VS 2005 VB.NET project and would like to change the color of the textbox when the user hovers over it. In a Module I have the following routines: Public Sub Button_Hover(ByRef btnName...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
16
by: mj.redfox.mj | last post by:
Can anyone help? I have a textbox which I'm programatically adding by using the following code: txtTest = New TextBox txtTest.ID = "txtLeft" + cntCount.ToString...
4
by: weg22 | last post by:
Hi all, I'm developing a Visual Basic 2005 application to communicate with an I2C device. I recently decided to add an i2c status bar. The status bar is just a textbox with the following...
3
by: hawaiijeff | last post by:
I have a form with four textboxes: A, B, C and D. Textbox A contains a date value. Textbox B is entered by the user, at which point the program locates a value in a table and uses that value to...
0
by: rehanmomin | last post by:
Just to start off, I am writing a web application using C#. I have a Menu which is binded to an XML datasource. There are three menu items each with submenus and a textbox where I want to display...
1
by: Jeff | last post by:
hi asp.net 2.0 Below is some markup I have trouble with. The problem is that the Textbox doesn't fill the entire DataCell. I've set width of TextBox to 100%.... The point is that I want the *...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.