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

Change table bgcolor programmatically

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 1159
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.Attributes("class") = "nameOfTheGreenStyle"

--

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

CS side
protected System.Web.UI.WebControls.Table _table;

_table.BackColor = System.Drawing.Color.Turquoise;

Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net
On 8 Jul 2004 09:21:37 -0700, sr*****@mailcity.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
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> <!--...
1
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
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...
2
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...
2
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 ...
4
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
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...
4
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...
2
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.