473,657 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change table bgcolor programmaticall y

sam
Hello Group,
I have a table which consists of few web datagrids. Based
on certain condition, I want to change the table bgcolor from the code
behind. Any help would be great!!

Thanks,
Sam.
Nov 18 '05 #1
2 1169
Jos
sam wrote:
Hello Group,
I have a table which consists of few web datagrids. Based
on certain condition, I want to change the table bgcolor from the code
behind. Any help would be great!!


Add the runat="server" attribute to the table tag like this:
<table id="myTable" runat="server">

From code then:
myTable.bgColor ="Green"

Even better would be to create a style sheet, and change
the class for the table:

myTable.Attribu tes("class") = "nameOfTheGreen Style"

--

Jos
Nov 18 '05 #2
HTML side
<asp:Table ID="_table" Runat="server" />

CS side
protected System.Web.UI.W ebControls.Tabl e _table;

_table.BackColo r = System.Drawing. Color.Turquoise ;

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net
On 8 Jul 2004 09:21:37 -0700, sr*****@mailcit y.com (sam) wrote:
Hello Group,
I have a table which consists of few web datagrids. Based
on certain condition, I want to change the table bgcolor from the code
behind. Any help would be great!!

Thanks,
Sam.


Nov 18 '05 #3

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

Similar topics

2
6156
by: Pete Kipe | last post by:
I'm not a JavaScript programmer...but I'm trying to put together a simple menu system for a new website and need a little help. I have the following script: <SCRIPT language=javascript> <!-- Hide JavaScript from Java-Impaired Browsers function NavRollOver(oTd) {if (!oTd.contains(event.fromElement)) {oTd.bgColor="#CC0000";}} function NavRollOut(oTd) {if (!oTd.contains(event.toElement))
1
1446
by: CYShao | last post by:
How to change the BGcolor of DateTimePicker ? I fialed to find any attributes of this, but only found BGcolor of calendar. How can I change the BGcolor of DateTimePicker window? Thanks CYShao
16
7401
by: Phil Hey | last post by:
Hi, I can change the icon for a folder by right clicking on it > going to the customize tab > and selecting Choose Picture. Does anyone know if it is possible to do this programmatically from a windows forms application?
2
7978
by: Greg Strong | last post by:
Hello All, Is it possible to change table field lookup properties in code? I've been able to change other field properties in code, however so far no luck with field lookup properties. What I've done for test purposes is use a text input file for the table field lookup properties. I thought that I'd start first by just changing the 'Display Control' property. Thanks to Allen Browne for some ideals per...
2
1967
ak1dnar
by: ak1dnar | last post by:
Here in my PHP page there is a table. with five rows (based on my $str_list ). and there is bgcolor for each and every row, what i need to cange this bg color alternately. if the that means for row 1,3,5... and 2,4...there should be two different colors. can we do that by checking the $x value is odd or even. <html> <body> <table width="150" border="0" cellspacing="0" cellpadding="0"> <?php $str_list = 'ABC;XYZ;PQR;KLM;HIJ'; $str =...
4
2849
by: ma | last post by:
Hello, I want to inject a piece of JavaScript inside a table cell. How can I do this? The table is statically created on master page.
0
1347
by: Michael | last post by:
I am trying to insert the same set of data into two tables with the same schema. One table is used for processing, the other for audit purposes. I thought that I could use the data change table reference FINAL TABLE to accomplish this, but I am getting a -20165 SQLCODE in the bind step of compilation (DB2 v8 + COBOL on z/OS). Basically, the statement looks like this: INSERT INTO AUDIT_TABLE SELECT * FROM FINAL TABLE ( INSERT INTO...
4
2098
by: ravisuguna | last post by:
Hi, I have a dynamic table in my programme in php and the value of a particular cell gets reduced after every 3 seconds.I want to change the bg color of that particular into a different color when it reaches '0'.Pl help me. thanks in advance Suguna
2
2288
by: Kyaw Kyaw Min | last post by:
I would like to change table name at SQL2000 database. I use alter statement ALTER TABLE Table_Name RENAME TABLE Old_Name TO New_Name
0
8402
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
8315
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
8829
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
7341
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
5633
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();...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
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.