Connecting Tech Pros Worldwide Forums | Help | Site Map

Change table bgcolor programmatically

sam
Guest
 
Posts: n/a
#1: Nov 18 '05
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.

Jos
Guest
 
Posts: n/a
#2: Nov 18 '05

re: Change table bgcolor programmatically


sam wrote:[color=blue]
> 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!![/color]

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


Bobby Ryzhy
Guest
 
Posts: n/a
#3: Nov 18 '05

re: Change table bgcolor programmatically


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, sri_san@mailcity.com (sam) wrote:
[color=blue]
>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.[/color]

Closed Thread