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

Toggle GridControl ReadOnly

Thread ID:

Created:

Updated:

Platform:

Replies:

48300 Aug 24,2006 07:24 AM UTC Aug 24,2006 08:50 AM UTC WinForms 1
loading
Tags: GridControl
gert donath
Asked On August 24, 2006 07:24 AM UTC

Hello All,

I have a large gridcontrol. Some of the cells are readonly and some of them are not. (even in same columns it can differ)
Wenn the users clicks on a button the grid has to become readonly. Wenn the users clicks again on the button the user can edit the grid again like it was before.
The enabled property is just what i need. The only problem then is that you can''t scroll.

I don''t wont to redraw the grid or to recalcualte which cells are editable and which are not, because i did it ones at startup.

Just need to toggle between readonly and the status as it was before.


thx in advance
Gert



Administrator [Syncfusion]
Replied On August 24, 2006 08:50 AM UTC

Hi Gert,

Instead of setting the Enabled property of the grid, you can handle the CurretCellActivating event to cancel the activates on current cell. Below is a code snippet.

bool isReadOnly = false;
private void EnabledButton4_Click(object sender, System.EventArgs e)
{
isReadOnly = !isReadOnly;
this.grid.CurrentCellActivating +=new GridCurrentCellActivatingEventHandler(grid_CurrentCellActivating);
this.grid.Selections.Clear();
}

private void grid_CurrentCellActivating(object sender, GridCurrentCellActivatingEventArgs e)
{ e.Cancel = isReadOnly; }

private void grid_SelectionChanging(object sender, GridSelectionChangingEventArgs e)
{e.Cancel = isReadOnly;}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/ReadOnlyGrid_5b46d9aa.zip

Let me know if this helps.
Best Regards,
Haneef

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

;