Hello KF,
You have surmised correctly. Using the runat="server" and giving the table
an ID allows you to access it in server side code. HtmlTable's are composed
of a HtmlTableRowCollection's. Iterating through the HtmlTableRowCollection
items will allow you to set the background for the row through the BgColor
property:
// Iterate through the rows of the table.
for (int i = 0; i <= Table1.Rows.Count - 1; i++)
{
// Update the properties of each row.
Table1.Rows[i].BgColor = BgColorSelect.Value;
Table1.Rows[i].BorderColor = BorderColorSelect.Value;
Table1.Rows[i].Height = HeightSelect.Value;
}
Futhermore, you can iterate through the the table cells of the row as well
and set properties for each cell (if you so wish).
--
enjoy - brians
http://www.limbertech.com
"ke*****@nospam.nospam" wrote:
I'm making admin forms. I'm wondering if there is a way to have the server
programmatically assign alternating colors in a regular table (not a
datalist control). I notice ASP.NET 2 offers a runat="server" attribute on
tables, leading me to believe that this should be possible.
Any ideas? I'm using C#.
Thanks,
-KF