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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

readonly cannot be reset

Thread ID:

Created:

Updated:

Platform:

Replies:

28223 Apr 27,2005 12:31 PM UTC Apr 28,2005 07:56 AM UTC WinForms 2
loading
Tags: GridControl
Raul Rosenthal
Asked On April 27, 2005 12:31 PM UTC

I have a databound grid with a column that uses a user control. Depending on locks put by other users editing the same data, I want to make the grid read-only or editable. When the grid goes read-only, I want my user control to display in a different way, so I set the column that contains it to read-only. The control is then made read-only by the grid, and it can handle the special display mode. I use the following code to make the grid read-only or editable: void SetGridReadOnly( bool ReadOnly ) { if ( ReadOnly ) { this.grdRule.Model.ColStyles[2].ReadOnly = ReadOnly; this.grdRule.EnableAddNew = !ReadOnly; this.grdRule.Model.ReadOnly = ReadOnly; } else { this.grdRule.Model.ReadOnly = ReadOnly; this.grdRule.Model.ColStyles[2].ReadOnly = ReadOnly; this.grdRule.EnableAddNew = !ReadOnly; } } Alas, when I try to reset the ReadOnly property in the ColStyle, it does not work. The grid ignores the new setting. I noticed a similar behavior also with simple columns (e.g. a TextBox). In that case, I could set the style to static, and work around the problem. In this case I don''t know what to do. Can you help, please? Thanks. Regards, Raul Rosenthal SDB SpA

Administrator [Syncfusion]
Replied On April 28, 2005 01:49 AM UTC

Hi Raul, Making a column readonly means that it cannot be changed (EVEN from code). If you later want to make a change to a readonly column, please set grid.IgnoreReadOnly = true, then make the change, and then set grid.ReadOnly back to false. This is by design. void SetGridReadOnly( bool ReadOnly ) { if ( ReadOnly ) { this.grdRule.Model.ColStyles[2].ReadOnly = ReadOnly; this.grdRule.EnableAddNew = !ReadOnly; this.grdRule.Model.ReadOnly = ReadOnly; } else { this.grdRule.IgnoreReadOnly = true; this.grdRule.Model.ReadOnly = ReadOnly; this.grdRule.Model.ColStyles[2].ReadOnly = ReadOnly; this.grdRule.EnableAddNew = !ReadOnly; this.grdRule.IgnoreReadOnly = false; } } Best regards, Jay N

Raul Rosenthal
Replied On April 28, 2005 07:56 AM UTC

Thank you. I''ll try this way. Regards, Raul

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.

Warning Icon 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.Close Icon

;