Alternate Grid Colors?

Where can I find the design time property to have my grid rows alternate color, or is this something better left for code? Thanks!

1 Reply

AD Administrator Syncfusion Team July 17, 2003 06:43 AM UTC

Currently, there are no property settings to control this, so you do have to do this from code. The most straight-forward way is in prepareViewStyleInfo setting e.Style.backColor based on the value of e.RowIndex.
Private Sub GridDataBoundGrid1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As GridPrepareViewStyleInfoEventArgs) Handles GridDataBoundGrid1.PrepareViewStyleInfo
	If e.RowIndex > 0 And e.RowIndex Mod 2 = 1 And e.ColIndex > 0 Then
		e.Style.BackColor = Color.LightGreen
        ElseIf e.RowIndex > 0 And e.ColIndex > 0 Then
		e.Style.BackColor = Color.White
	End If
End Sub

Loader.
Up arrow icon