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.

ReadOnly Problem

Thread ID:

Created:

Updated:

Platform:

Replies:

20419 Oct 18,2004 02:34 PM Oct 19,2004 02:59 PM Windows Forms 8
loading
Tags: GridControl
Patrick
Asked On October 18, 2004 02:34 PM

I have a grid that enables ReadOnly on a per cell basis for the whole grid. Based on user input I disable the ReadOnly property for certain cells, but they will not change to ReadOnly = false now. This process used to work in the 1.6.xx.xx version and we just noticed it does not work with the 2.x update. I''ve written a small test program that demonstrates the problem. If you press one button it sets ReadOnly= True for all cells of the grid. Then when you press the other to set ReadOnly = False the control ignores the assignment and the cells stay readOnly. TIA Patrick WindowsApplication7_2636.zip

Administrator [Syncfusion]
Replied On October 18, 2004 03:22 PM

Setting a cell ReadOnly also makes it ReadOnly for programatic changes too. To change a ReadOnly cell, you first need to set grid.IgnoreReadOnly = true, then make the change, then reset the IgnoreReadOnly property.
GridControl1.IgnoreReadOnly = True
For i = 1 To 10
     For j = 1 To 10
           GridControl1(i, j).ReadOnly = False
     Next
Next
GridControl1.IgnoreReadOnly = False

Patrick
Replied On October 19, 2004 09:32 AM

You missed what I was trying to do. I look all cells on a row until the user selects a value from a dropdown combo. Then I unlock a row for the user to enter data. I''m not trying to programatically input data. If you ran the test program you would see that then it starts you can input data manually. Press the readonly-on button and your locked out. Press the readonly-off button and you still can''t type in data. If you step through with a debugger when you step throught the line in button2_click that sets the readonly property to false it will not change. It stays True if you watch it in the watch window. Like I said this was not a problem in the 1.6.x version of your grid product. Patrick

Administrator [Syncfusion]
Replied On October 19, 2004 11:24 AM

>>Then I unlock a row for the user to enter data How do you unlock the row? From your code, it looks like you are looping through the cells and trying to change the ReadOnly property (programatically). Is this what you want to do? Loop through the cells and turn a ReadOnly cell into a non-readonly cell? If so, then you will have to set grid.IgnoreReadOnly = true in order to do this. A cell set to ReadOnly can not have any property changed (Text, BackColor, Font,... ReadOnly) unless you tell the grid to ignore the readonly flag. If I have misunderstood what you what you want, please tell me what you are doing differently than looping through readonly cells, trying to make them not readonly.

Patrick
Replied On October 19, 2004 12:52 PM

Ok, then you guys broke your control from the way it used to work. This worked fine in the 1.6.xx version. The IgnoreReadOnly doesn''t make sense becase it works on the whole grid not a cell. Also when I lock all the cells and then turn on the IgnoreReadOnly property it allows the user to type into all the cells. As I understand it the IgnoreReadOnly is supposed to allow you to lock a cell from user input but allow the program to modify the contnents. And speaking of that it doesn''t make any sense to allow the program to set the readonly property but then not be able to turn it off unless you go set another property some where else. I''ve never liked the idea that you would lock cells from the program, it''s not need. All I need is to be able to lock/unlock cells individually form the program side. Like I said it used to work fine but for some reason the functionality in your control changed. Patrick

Patrick
Replied On October 19, 2004 01:08 PM

Let me clarify futher, I want to be able to lock cells, from user input. I don''t care about locking the grid from programatic changes, I can control that. Depending on the user selection in a combo box I''m going to unlock rows from the top down for the user to input data. I do this on a row by row basis. I can''t have the user accidently entering data in lower rows so I lock them. I want the ReadOnly property to stop user input only, not programitic input. Hope that helps explain things. Patrick

Administrator [Syncfusion]
Replied On October 19, 2004 01:49 PM

To do what you want to do, you must use IgnoreReadOnly to flip the readonly setting. Here is your sample back with both buttons working to flip the readonly propety of the grid cells. I just added the 2 IgnoreReadOnly lines that allow the buttons to change the ReadOnly property. WindowsApplication7_7830.zip

Administrator [Syncfusion]
Replied On October 19, 2004 02:16 PM

I would like to as one question, why did you prgoram the readonly functionality the way you did? Why have it block programatic changes? It doesn''t work like the standard Winform controls. Thanks Patrick

Administrator [Syncfusion]
Replied On October 19, 2004 02:59 PM

The reason is that you programatically changing a cell value triggers the same change events that are triggerred when the user changes something. This means that one event can handle saving all changes. This event does not know what triggerred the change. If the style is ReadOnly and IgnoreReadOnly is false, it will not save the change.

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.

;