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

Readonly BackColor

Thread ID:





11271 Mar 1,2004 06:27 PM UTC Mar 22,2004 12:02 PM UTC WinForms 3
Tags: GridControl
Greg Wright
Asked On March 1, 2004 06:27 PM UTC

Is there any way to use styles (or another method) to have the BackColor of cells determined by the ReadOnly status of each cell or the ReadOnly status of the grid? For example, if the ReadOnly of the grid is false, cells with a ReadOnly = true would have a gray BackColor, and those cells with a ReadOnly = false have a white BackColor. If ReadOnly for the grid is set to true, and cells would have a BackColor of gray. Thanks, Greg

Greg Wright
Replied On March 1, 2004 07:04 PM UTC

The last sentence should say ''If ReadOnly for the grid is set to true, ALL cells would have a BackColor of gray.''.

Administrator [Syncfusion]
Replied On March 1, 2004 08:05 PM UTC

You can handle PrepareViewStyleInfo to do this.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	if(e.ColIndex > 0 && e.RowIndex > 0)
		if(this.gridControl1.ReadOnly || e.Style.ReadOnly)
			e.Style.BackColor = Color.FromArgb(240, 240, 240);

Greg Wright
Replied On March 22, 2004 12:02 PM UTC

Thanks Clay.


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