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

Setting the color and non-editable properties of a specific row in Grid

Thread ID:





4220 May 3,2003 10:45 AM UTC May 3,2003 07:13 PM UTC WinForms 1
Tags: GridControl
Asked On May 3, 2003 10:45 AM UTC

In SyncDatagrid 1.I'm unable to set the backcolor for a specific row/cell in spite of trying the rowstyles and other backcolor properties . 2.I'm unable to set a row/cell read-only .

Administrator [Syncfusion]
Replied On May 3, 2003 07:13 PM UTC

In a GridDataBoundGrid, you cannot set rowstyles or individual cellstyles as there is storage allcoated for such object. In a GridControl, you can use rowstyles and set individual cell styles. In a GridDataBoundGrid, you can set styles for rows or individual cells by handling the PrepareViewStyleInfo event. In it, if e.RowIndex points to the row want was to set teh styles on, and if e.ColIndex > 0, then set e.Style with the properties you want to use. You can also set individual cells readonly in PrepareViewStyleInfo.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	//only check interior cells
	if(e.ColIndex > 0 && e.RowIndex > 0)
		if(e.RowIndex % 3 == 0 )
                     e.Style.BackColor = Color.Teal;


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