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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Alternate Grid Colors?

Thread ID:





5758 Jul 16,2003 11:18 PM UTC Jul 17,2003 06:43 AM UTC WinForms 1
Tags: GridControl
Ken Bryant
Asked On July 16, 2003 11:18 PM UTC

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

Administrator [Syncfusion]
Replied On 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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon