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

Cell readonly property

I am trying to set individual cells to readonly under certain circumstances and then be able to then turn it off and make the cell editable during other circumstances. I know there was a bug with the readonly proper and setting it in the ide and it not being able to be turned off. Is this the same problem if u set it in the code? I have attached a sample where i load 10 rows with text and set the readonly to true. If u click the button on the form it should change the text. I cant make that work. It ignores me changing the readonly back to false. Thanks Phil ReadOnly_7874.zip

5 Replies

AD Administrator Syncfusion Team March 5, 2004 12:58 PM UTC

If a style is set ReadOnly, then you cannot change it, even programatically. (This means you cannot change the style.ReadOnly property either.) So, to handle this process of changing ReadOnly styles, there is a grid wide flag that you can set to tell the grid to ignore ReadOnly settings, and this will allow you to make changes. //turn off readonly this.grid.IgnoreReadOnly = true; // change your styles... //.... //turn readonly back on this.grid.IgnoreReadOnly = false;


PB Philip Bishop March 5, 2004 01:57 PM UTC

Clay, Ok I am confused about when u said the "style.ReadOnly " property. In the sample I never set a style property unless thats what it does when i use the following line of code gridcontrol(1,1).readonly = true. I guess I am confused about that because of a direct trac incident that another programmer with us had. The number is 5567 and in that you said that it is a bug in the ide but that you can set it in the code? Are we talking about differnt settings here. Phil


AD Administrator Syncfusion Team March 5, 2004 02:33 PM UTC

GridControl(i,1) returns a GridStyleInfo object, so yes, you are setting ReadOnly on style objects. The incident you referred to was strictly at design time, not runtime. Did you try what I susgested? I think it should work. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click GridControl1.IgnoreReadOnly = True Dim i As Integer For i = 1 To 10 GridControl1(i, 1).ReadOnly = False GridControl1(i, 1).CellValue = "Reset" Next GridControl1.IgnoreReadOnly = False End Sub


CH Charles June 16, 2004 05:24 PM UTC

I''ve tried as you suggested as follows: DataGrid1.DataBoundGridModel.IgnoreReadOnly = true; DataGrid1.DataBoundGridModel[2,4].ReadOnly = true; DataGrid1.DataBoundGridModel.IgnoreReadOnly = false; The difference is that I want the value on ReadOnly property on the specific sell to remain True. The issue is that the ReadOnly property never sets to true when I step through it in the debuggger. Thanks, Charles


AD Administrator Syncfusion Team June 16, 2004 06:04 PM UTC

The grid where we showed the code was a GridControl. It looks like you are trying to use a GridDataBoundGrid. You cannot set cell specific properties (other than CellValue) in a GridDataBoundGrid. Instead, you have to use an event like grid.Model.QueryCellInfo or grid.PrepareViewStyleInfo. Check out this KB. http://www.syncfusion.com/Support/article.aspx?id=10351

Loader.
Live Chat Icon For mobile
Up arrow icon