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 properties on Read-Only cells.

Thread ID:

Created:

Updated:

Platform:

Replies:

18208 Aug 25,2004 09:34 PM Aug 26,2004 07:59 AM Windows Forms 3
loading
Tags: GridControl
Ted Osberg
Asked On August 25, 2004 09:34 PM

I would like to know why this behavior is what it is: I set a cell to readonly. I change the backcolor of the cell for the first time - it works. When I go to change it back to another color later, it suddenly doesn''t work. I am using just a GridControl (not a databoundgrid). I am curious as to why it works once, but no more times thereafter (unless I set Grid.Model.IgnoreReadOnly to false, change the color, and then set the IgnoreReadOnly back to TRUE again. What''s the dilly?

Administrator [Syncfusion]
Replied On August 26, 2004 01:27 AM

If I drop a GridControl on a form, and add a button, and a buttonclick handler like this:
private void button1_Click(object sender, System.EventArgs e)
{
	this.gridControl1[2,2].ReadOnly = true;
	this.gridControl1[2,2].BackColor = Color.Red;
}
clicking the button does not change the color of the cell for me. If you are seeing the color change the first time, I suspect you are executing the change code at some point the grid has the original style cached (maybe its the style for the current cell, and you are trying to set it while the cell is editing or something), and it is the cached old style that is allowing the first change to take. Just a guess. If you can post a sample showing the behavior, we can probably provide a more concrete explanation.

Ted Osberg
Replied On August 26, 2004 07:39 AM

I made a mistake. I set the ReadOnly thru the ColStyles. Does setting properties thru the Cell itself trump the ColStyles? I know that RowStyles trump ColStyles, so does setting the actual Cell properties override both ColStyles and RowStyles? >If I drop a GridControl on a form, and add a button, and a buttonclick handler like this: >
>private void button1_Click(object sender, System.EventArgs e)
>{
>	this.gridControl1[2,2].ReadOnly = true;
>	this.gridControl1[2,2].BackColor = Color.Red;
>}
>
>clicking the button does not change the color of the cell for me. If you are seeing the color change the first time, I suspect you are executing the change code at some point the grid has the original style cached (maybe its the style for the current cell, and you are trying to set it while the cell is editing or something), and it is the cached old style that is allowing the first change to take. Just a guess. > >If you can post a sample showing the behavior, we can probably provide a more concrete explanation.

Administrator [Syncfusion]
Replied On August 26, 2004 07:59 AM

Yes. Cell specific setting have the highest precedence.

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.

;