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.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

4220 May 3,2003 06:45 AM May 3,2003 03:13 PM Windows Forms 1
loading
Tags: GridControl
Loga
Asked On May 3, 2003 06:45 AM

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 03:13 PM

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

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.

;