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

Grid Grouping Control New Row Refresh from underlying data source object

Hi I''m using the GridGrouping Control and using an IBindingList to attach to the DataSource. When I enter data in col1 of a "*" new row (Record), I update the underlying data object for col2 directly. The value of which should be displayed in col2. However the new row (Record) does not show the updated col2 value which I updated in the underlying data object. How can I get the "*" new row record to be refreshed from the underlying data object, such that when I make changes to the underlying "*" new row Record object, I get the changes reflected in the "*" new row record.

3 Replies

AD Administrator Syncfusion Team October 24, 2004 01:00 PM UTC

Here is a little sample. It calls EndEdit on the AddNewRecord so your can then update it from outside the grid. GGCNewRow_8486.zip


AD Administrator Syncfusion Team October 24, 2004 08:00 PM UTC

Hi Clay, Thanks for getting back so soon, I had a look at your sample, it''s not entirely what I want to do. What I would like to do is have the all the changes to the underlying data object appear on the "*" new row, rather than appear on another row on the grid once the user has pressed enter on the row. I want to be able to see values in dependent cells on the "*" new row and then at the end hit enter to create a new row in the underlying data source. Thanks John


AD Administrator Syncfusion Team October 24, 2004 09:44 PM UTC

Try handling TableControlCurrentCellChanged and add the valuse at that point. Also handle TableControlCurrentCellMoved to reset a bool flag that makes sure you only add the values once. Here are handlers that you can add to the above sample (you also need to subscribe to the two events.)
private bool addedValuesInNewRow = false;
private void gridGroupingControl1_TableControlCurrentCellMoved(object sender, GridTableControlCurrentCellMovedEventArgs e)
{
	if(e.TableControl.CurrentCell.MoveToRowIndex != e.TableControl.CurrentCell.MoveFromRowIndex)
		addedValuesInNewRow = false;
}
private void gridGroupingControl1_TableControlCurrentCellChanged(object sender, GridTableControlEventArgs e)
{
	if(this.gridGroupingControl1.Table.AddNewRecord.IsEditing && !addedValuesInNewRow)
	{
		this.gridGroupingControl1.Table.AddNewRecord.SetValue("Col2", r.Next(1000)); 
		this.gridGroupingControl1.Table.AddNewRecord.SetValue("Col3", r.Next(1000)); 
		this.gridGroupingControl1.Refresh();
		addedValuesInNewRow = true;
	}
}

Loader.
Up arrow icon