Hi Jeff,
I assume you're referring to <asp:Table> (System.Web.UI.WebControls.Table).
Let me know if this is not the case.
You could easily use Table.Rows(index) to get a reference to individual row
(of type TableRow). From the TableRow reference, you can use
TableRow.Cells(index) to get a reference to individual cell (of type
TableCell). Both of them also have a property named BackColor which can let
you set their background color.
I've written following code snippet to demonstrate how to change a row or
column's background color:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
' Add some rows/columns to the table
For i As Integer = 1 To 10
Dim tr As New TableRow
For j As Integer = 1 To 10
Dim td As New TableCell
td.Text = i.ToString + "." + j.ToString()
tr.Cells.Add(td)
Next
table1.Rows.Add(tr)
Next
' change third row's background color
table1.Rows(2).BackColor = Drawing.Color.Blue
' change third column's background color
' since the table is row-oriented, we need to set the cell
row-by-row
For i As Integer = 0 To table1.Rows.Count - 1
table1.Rows(i).Cells(2).BackColor = Drawing.Color.Gray
Next
End Sub
Hope this helps.
Sincerely,
Walter Wang (
[email protected], remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.