We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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 02:43 AM

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.
Live Chat Icon For mobile
Up arrow icon