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.

Cell readonly property

Thread ID:





11431 Mar 5,2004 07:31 AM Jun 16,2004 02:04 PM Windows Forms 5
Tags: GridControl
Philip Bishop
Asked On March 5, 2004 07:31 AM

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

Administrator [Syncfusion]
Replied On March 5, 2004 07:58 AM

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;

Philip Bishop
Replied On March 5, 2004 08:57 AM

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

Administrator [Syncfusion]
Replied On March 5, 2004 09:33 AM

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

Replied On June 16, 2004 01:24 PM

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

Administrator [Syncfusion]
Replied On June 16, 2004 02:04 PM

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


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.