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

Alternate Grid Colors?

Thread ID:

Created:

Updated:

Platform:

Replies:

5758 Jul 16,2003 07:18 PM Jul 17,2003 02:43 AM Windows Forms 1
loading
Tags: GridControl
Ken Bryant
Asked On July 16, 2003 07:18 PM

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 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

CONFIRMATION

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.

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.

;