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

readonly column style problems

Hello, Having an interesting issue. I'm setting a column style to ReadOnly = true and the CellType to a custom cell type derived from "Static". This column style is stored in the grid (not provided in QueryCellInfo). In my QueryCellInfo for a cell within this column, a number of style properties are not coming through from the column style, including CellType (it's "TextBox"), DataSource, TextColor, etc. If I only change the ReadOnly property for the column style to false, everything comes through fine. Is there a reason for this? Using 1.6.1.0. Thanks, Terry

7 Replies

AD Administrator Syncfusion Team October 3, 2003 02:54 PM UTC

Does setting Model.IgnoreReadOnly = true before you apply values in QueryCellInfo and setting Model.IgnoreReadOnly = false afterward help? It looks to me as if the ReadOnly setting is enforced during the QueryCellInfo call. Shouldn't normally happen, though ... Let me know what you find out. Thanks, Stefan


TF Terry Foster October 6, 2003 11:52 AM UTC

I'm not quite understanding what you're suggesting, which makes me think I didn't explain myself very well. I'm working with a partial virtual grid where, when I first create the grid, I set the RowCount and ColCount properties up front (not through QueryRowCount or QueryColCount) and set the ColumnStyle properties for each of the columns up front (not through QueryCellInfo). I then let the grid populate the rest of the grid through the QueryCellInfo event. I want and expect the column style that I set at the outset to always come through when I need to set an individual cell style's CellValue (within that column) through the QueryCellInfo event. This DOES work in all cases except when I had set the column style to be ReadOnly (again, which I only set once at the outset). The ReadOnly value comes through (which I want), but many other style properties are lost. I'm not sure when or where I could apply the IgnoreReadOnly property since I only set the column style once at the outset and the cell style whenever the grid needs to query for it. I hope this clarifies. I realize none of your documentation condones a 'partial virtual grid' like this one, but there ARE reasons why I'm doing it like this. I have added quite a bit of functionality to my partial virtual grid and since my last post, I tried emulating the same behavior, as described above, in a new, very simple grid. When I did this, things worked the way I should expect, which suggests that I've done something in my fully implemented partial virtual grid to cause this adverse behavior, but can't fathom what it is. I'll have to look into it more, trying to close the gap between these two grids till I track down the issue, but any insight into what might be causing this would be greatly appreciated. Thanks, Terry


TF Terry Foster October 6, 2003 11:52 AM UTC

I'm not quite understanding what you're suggesting, which makes me think I didn't explain myself very well. I'm working with a partial virtual grid where, when I first create the grid, I set the RowCount and ColCount properties up front (not through QueryRowCount or QueryColCount) and set the ColumnStyle properties for each of the columns up front (not through QueryCellInfo). I then let the grid populate the rest of the grid through the QueryCellInfo event. I want and expect the column style that I set at the outset to always come through when I need to set an individual cell style's CellValue (within that column) through the QueryCellInfo event. This DOES work in all cases except when I had set the column style to be ReadOnly (again, which I only set once at the outset). The ReadOnly value comes through (which I want), but many other style properties are lost. I'm not sure when or where I could apply the IgnoreReadOnly property since I only set the column style once at the outset and the cell style whenever the grid needs to query for it. I hope this clarifies. I realize none of your documentation condones a 'partial virtual grid' like this one, but there ARE reasons why I'm doing it like this. I have added quite a bit of functionality to my partial virtual grid and since my last post, I tried emulating the same behavior, as described above, in a new, very simple grid. When I did this, things worked the way I should expect, which suggests that I've done something in my fully implemented partial virtual grid to cause this adverse behavior, but can't fathom what it is. I'll have to look into it more, trying to close the gap between these two grids till I track down the issue, but any insight into what might be causing this would be greatly appreciated. Thanks, Terry


AD Administrator Syncfusion Team October 6, 2003 03:04 PM UTC

I suspect the problem is that at the time QueryCellInfo is called and the style object already has knowledge about the parent style object that at this time the style locks out changes because of its readonly setting. If that is the case then this is a bug. You should be able to make any changes in QueryCellInfo even if the object is readonly. I will try to create a sample for that and then fix the problem in our code base. Setting the IgnoreReadOnly = true is a work around that should let you do that in the meantime. You just set it at the start of your QueryCellInfo handler and reset it before your method returns. Stefan


AD Administrator Syncfusion Team October 6, 2003 05:39 PM UTC

I setup a small sample now but I could not reproduce the problem. I do set a column style readonly with this.ColStyles[1].ReadOnly = true; and then I handle QueryCellInfo protected override void OnQueryCellInfo(GridQueryCellInfoEventArgs e) { e.Style.Text = "TEST"; base.OnQueryCellInfo (e); } This seems to work fine. What should I do different? Stefan


YA yadu April 6, 2004 09:05 AM UTC

I am facing the same problem and since last three days I am trying to find out the solution. To reproduce the same please do the following steps: (1) In a windows form place a Syncfusion Grid.GridControl (2) Place two different button in the screen (a) In First button click write down the following code: Grid1.ColStyles(6).ReadOnly = True (b) In second button click write down the following code Actuals.ColStyles(6).ReadOnly = False When I clicks the first button 6th column of grid becomed read only. That''s fine. But when I press second button the 6th button should be editable. but it is not working. Thank You Yadu Mani Kar


AD Administrator Syncfusion Team April 6, 2004 09:29 AM UTC

Yadu, in your second button (b) you first need to set IgnoreReadOnly = true; and after changing style.ReadOnly set IgnoreReadOnly = false; Then your code should work. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon