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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Edit Mode

Thread ID:





36430 Oct 29,2005 09:28 PM UTC Nov 17,2005 07:56 PM UTC WinForms 12
Tags: GridControl
Asked On October 29, 2005 09:28 PM UTC

I am in edit mode of the GRID control, when user enters a value in a cell and clicks on Apply button, the value of the current cell is not available in the Apply button method? What should I do to commit changes for the edited cell? Thanks

Administrator [Syncfusion]
Replied On October 29, 2005 10:44 PM UTC

Try calling grid.CurrentCell.CommitChanges(); in a GridControl. You can also try calling grid.CurrentCel.EndEdit(). In a GridDataBoundGrid, in addition to the above, you might need to call grid.Binder.EndEdit().

Administrator [Syncfusion]
Replied On November 11, 2005 06:11 PM UTC

hi, I have the same problem with a GDBG. I changed the value of a cell. But after pressing the ENTER-Key, the new value is not available in the datasource (a datatable). I tried grid.Binder.EndEdit, grid.BindingContext[datasource].EndCurrentEdit(), but that all had no effect. But after editing the neighbor-cell (Checkbox-cell) the value in the textbox-cell is also available in the datasource. Is this a bug? :-/

Administrator [Syncfusion]
Replied On November 11, 2005 06:55 PM UTC

The default behavior of the GriddataBoundGrid is to only save the modified record when you leave the grid row. This is by design. Here are some more things to try in your case. 1) Try setting grid.Binder.DirectSaveCellInfo = true when you initially set up the grid to see if this will make things work the way you want them to. 2) grid.Currentcell.EndEdit(); grid.BindingContext[grid.DataSource, grid.DataMember].EndCurrentEdit();

Administrator [Syncfusion]
Replied On November 12, 2005 08:18 AM UTC

Hi, the grid.Binder.DirectSaveCellInfo = true has no effect. If I call grid.CurrentCell.EndEdit() in the ...CurrentCellValidated - event, this will cause a stackoverflowError (because the ...CurrentCellValidated is called again). Also your last proposal has no effect.

Administrator [Syncfusion]
Replied On November 12, 2005 09:34 AM UTC

You can avoid the stack overflow by using a flag. Or, you could try a different event like CurrentCellMoved. Can you upload a sample showing the problem you are having?

Administrator [Syncfusion]
Replied On November 12, 2005 10:41 AM UTC

Hi, here is a small sample-application. Do the following: Set a stop-point to the currentcellvalidated-eventhandler, start the app. and change the value (e. g. in the last record), press enter and watch the value in the table. Greetings Falk


Administrator [Syncfusion]
Replied On November 12, 2005 10:54 AM UTC

Here is code that worked for me in your sample(without using DirectCellSaveInfo).
bool inCellValidated = false;
private void gridDataBoundGrid1_CurrentCellValidated(object sender, System.EventArgs e) {
		inCellValidated = true;
		inCellValidated = false;
		//check value - code not needed
		CurrencyManager cm = gridDataBoundGrid1.BindingContext[gridDataBoundGrid1.DataSource] as CurrencyManager;
		DataRowView drv = cm.Current as DataRowView;

Administrator [Syncfusion]
Replied On November 12, 2005 12:17 PM UTC

Yes, this works, but it''s a pity that a workaround is necessary; Thank you Greetings Falk

Administrator [Syncfusion]
Replied On November 12, 2005 12:24 PM UTC

It is your choice of events that is why you need the code. In CurrentCellValidated, you know the value is ok, but it is not been saved by the cuurentcell yet. Try using CurrentCellAcceptedChanges. At that point, the currentcell has comittted its changes.

Administrator [Syncfusion]
Replied On November 13, 2005 05:54 PM UTC

Ah - that''s it! This is what I''m looking for! Thank you very much! Greetings Falk

Administrator [Syncfusion]
Replied On November 17, 2005 07:35 PM UTC

Sorry - it''s me again. I was wrong: it is still not working. (I don''t know how I could think so)! The CurrentCellAcceptedChanges-event is fired to late. I''m looking for the following behavior: I want to check a bool-value (Checkbox) in a GDBDGD. Immediately after checking the new value must be written to the table and in the next step the table-changes must be written to the database (an update - just on moving the mousebutton up). At this time the update is done by leaving the grid or editing another cell. Sorry for my hardheadedness - but I need this behavior. Falk

Administrator [Syncfusion]
Replied On November 17, 2005 07:56 PM UTC

Try handling the grid.CheckBoxClick event. There call grid.Binder.EndEdit.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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