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 Background color for Grid rows

Thread ID:





17690 Aug 13,2004 02:43 PM UTC Aug 13,2004 02:53 PM UTC WinForms 1
Tags: GridControl
Asked On August 13, 2004 02:43 PM UTC

Hello, How can I have a grid with first row background, let''s say, yellow, 2nd one white, 3rd yellow and so on? Is there a property for that or must I paint them myself? Thank you in advance. FJ

Administrator [Syncfusion]
Replied On August 13, 2004 02:53 PM UTC

To color alternate rows in a GridDataBoundGrid you would have to use the PrepareViewStyleInfo event.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	if(e.RowIndex > 0 && e.ColIndex > 0)
		if(e.RowIndex % 2 == 1)
			e.Style.BackColor = Color.LightBlue;
			e.Style.BackColor = Color.DodgerBlue;


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