Change row color from datagrid

  • Thread starter Thread starter Nelson Xu
  • Start date Start date
N

Nelson Xu

Does anybody can tell me how to dynamically change row
color from datagrid in .net.

Thanks in advance !

Nelson
 
Well, I've had to change the fore color of an item in a data grid before, so I think the following bit of sample code with a little bit of tweaking should help you out

Private Sub dgResults_ItemDataBound (ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)...
Dim dgiCurrent As DataGridIte

dgiCurrent = e.Ite
If dgiCurrent.Cells(2).TextStartsWith("(800)") The
dgiCurrent.Cells(2).ForeColor = Color.Re
End I

If dgiCurrent.Cells(1).Text.StartsWith("Federal") The
dgiCurrent.Cells.Font.Bold = tru
End I
End Su

Good Luck
 
Back
Top