Change table bgcolor programmatically


S

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.
 
Ad

Advertisements

J

Jos

sam said:
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"
 
Ad

Advertisements


Top