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. Image for the cookie policy date

Attaching row?

When the GDBG is allowed to have a new row added, that row remains detached until the user leaves the row. This is causing me much grief in getting the grid to refresh properly when attempting to manipulate the datarow. Is there a way to force the detached row to be added to the table? Thanks, Virgil

3 Replies

VI Virgil September 1, 2005 02:25 PM UTC

Side question. Are Binder.DirectSaveCellInfo and Binder.DefaultCurrentRecordItemChangedBehavior = GridCurrentRecordItemChangedBehavior.ReloadCurrentRecord opposites?


AD Administrator Syncfusion Team September 1, 2005 04:02 PM UTC

I am not sure if this is what you want, but you can handle the RowEnter event and if you are entering the AddNewRow, go ahead and add a new row yourself.
private void gridDataBoundGrid1_RowEnter(object sender, GridRowEventArgs e)
{
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(e.RowIndex == this.gridDataBoundGrid1.Model.RowCount)
	{
		DataTable dt = this.gridDataBoundGrid1.DataSource as DataTable;
		dt.Rows.Add(dt.NewRow());
	}
}
I would not exactly say those two properties are opposite. DefaultCurrentRecordItemChangedBehavior controls what happens if you are actively editing a grid cell, and something outside the grid changes the IBindingList datasource. DirectSaveCellInfo = true raises an IBindingList ItemChanged event each time you change cells even if you are moving in the same row. The default behavior is to only rasie the event when the position in the data list changes.


VI Virgil September 2, 2005 03:54 PM UTC

This seemed to work for me: GridDataBoundGrid1.CommitChanges() One that happened, I could work directly with the datarow and things would appear properly on the grid.

Loader.
Live Chat Icon For mobile
Up arrow icon