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.

EnableEdit in GridDataBoundGrid not working as expected?

Thread ID:

Created:

Updated:

Platform:

Replies:

49897 Sep 29,2006 04:34 AM Sep 29,2006 07:00 AM Windows Forms 2
loading
Tags: GridControl
Filip L'Hommelet
Asked On September 29, 2006 04:34 AM

The description of EnableEdit is: A value indicating if the grids supports editing records if the underlying datasource allows it.

So what do I expect:
If I set EnableEdit to false, one should not be able to change values from EXISTING records!

What happens:
I cannot change values from existing records, but if I add a new record in the grid (I''m on the last record and just go one down so that I get a new empty record), I am not able to input any values at all in that new record?? How can this supposed to be working like this? This is not what the description says, since a new records is not yet a record in the underlying datasource yet!

Question: How can I make sure people cannot alter fields of existing records but are still able to add new records in a GridDataBoundGrid?

Administrator [Syncfusion]
Replied On September 29, 2006 06:09 AM

Hi Filip,

This can be acheived by handling the CurrentCellStartEditing event and set the EnableEdit property to TRUE when the AddNewRecord is activated. Below a code snippet

private void grid_CurrentCellStartEditing(object sender, CancelEventArgs e)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid;
if( grid.Binder.IsAddNew || grid.Binder.IsAppendRow)
{
grid.EnableEdit = true;
}
else
grid.EnableEdit = false;
}

Sample : http://www.syncfusion.com/Support/user/uploads/GDBGEnableEdit_50b6900a.zip

Let me know if you trying something different.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On September 29, 2006 07:00 AM

Thank you for your quick response,
I had found another way to achieve this
using the code and examples from http://www.syncfusion.com/support/forums/message.aspx?MessageID=20985

but I will try your solution too because it looks more elegant!

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.

;