如何:添加背景颜色为蓝色的数据行和“选中”复选框,但其余部分的背景颜色为蓝色
请参阅下面的代码。谢谢您的帮助
Dim table2 As New DataTable
' Create four typed columns in the DataTable.
table2.Columns.Add("ID", GetType(Integer))
table2.Columns.Add("Drug", GetType(String))
table2.Columns.Add("Patient", GetType(String))
table2.Columns.Add("Date", GetType(DateTime))
' Add five rows with those columns filled in the DataTable.
table2.Rows.Add(25, "Indocin", "David", DateTime.Now)
table2.Rows.Add(50, "Enebrel", "Sam", DateTime.Now)
table2.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now)
table2.Rows.Add(21, "Combivent", "Janet", DateTime.Now)
table2.Rows.Add(10, "Dilantin", "Melanie", DateTime.Now)
table2.Rows.Add(125, "Indocin", "David", DateTime.Now)
table2.Rows.Add(150, "Enebrel", "Sam", DateTime.Now)
table2.Rows.Add(2, "Hydralazine", "Christoff", DateTime.Now)
'GridView1.DataSource = table2
For Each dr As DataRow In table2.Rows
If dr("ID") = 21 Or dr("ID") = 150 Then
' add a data row with a back ground colour - blue and check check box
Else
' add a data row with a back ground colour - yellow
End If
Next
GridView1.DataBind()