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 Backcolor for Rows ? (MS DataGrid gives it!)

Thread ID:





2577 Feb 1,2003 10:29 AM UTC Feb 1,2003 04:59 PM UTC WinForms 1
Tags: GridControl
Asked On February 1, 2003 10:29 AM UTC

Hi It seems we have to loop around all the rows to set an alternate colors between rows. Any other ways? why dont you directly have a property like we have in .Net datagrid? Regards Rajaraman California Software, INDIA

Administrator [Syncfusion]
Replied On February 1, 2003 04:59 PM UTC

Handle the PrepareViewStyleInfo event, and then conditionally set the e.Style.BackColor in what ever manner you like. For example, you can do every 3 rows instead of every other row :)
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	if(e.ColIndex > 0 && e.RowIndex > 0)
		if(e.RowIndex % 3 == 0) //use 2 for every other row
			e.Style.BackColor = Color.LightBlue;
			e.Style.BackColor = Color.White;


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