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.

Grid Edit Mode

Thread ID:

Created:

Updated:

Platform:

Replies:

36430 Oct 29,2005 05:28 PM Nov 17,2005 02:56 PM Windows Forms 12
loading
Tags: GridControl
Pani
Asked On October 29, 2005 05:28 PM

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 06:44 PM

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 01:11 PM

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 01:55 PM

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 03:18 AM

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 04:34 AM

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 05:41 AM

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

GDBGProblemSample.zip

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

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) {
	if(!inCellValidated)
	{
		inCellValidated = true;
		this.gridDataBoundGrid1.CurrentCell.EndEdit();
		gridDataBoundGrid1.Binder.EndEdit();
		inCellValidated = false;
		
		//check value - code not needed
		CurrencyManager cm = gridDataBoundGrid1.BindingContext[gridDataBoundGrid1.DataSource] as CurrencyManager;
		DataRowView drv = cm.Current as DataRowView;
		Console.WriteLine(drv["VALUE"]);
	}
}

Administrator [Syncfusion]
Replied On November 12, 2005 07:17 AM

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

Administrator [Syncfusion]
Replied On November 12, 2005 07:24 AM

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 12:54 PM

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

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

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 02:56 PM

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

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.

;