Default Data in Add New Row

I am looking for a way to default data into the add new row in the Grid Grouping Control (v. 3.3). I have a simple grouping with a group name and several items under it. Thanks for any help.

3 Replies

AD Administrator Syncfusion Team November 28, 2005 08:22 PM UTC

You can try handling CurrentRecordContextChange and set the defaults there if you are starting to edit a record.
private void gridGroupingControl1_CurrentRecordContextChange(object sender, Syncfusion.Grouping.CurrentRecordContextChangeEventArgs e)
{
	if(e.Action == CurrentRecordAction.BeginEditComplete && e.Record is GridAddNewRecord)
	{
		GridAddNewRecord rec = e.Record as GridAddNewRecord;
		rec.SetValue("Col0", "Col0Default");
		rec.SetValue("Col1", "Col1Default");
		rec.SetValue("Col2", "Col2Default");
		rec.SetValue("Col3", "Col3Default");
	}
}


PT Peter Titus November 28, 2005 10:17 PM UTC

Thanks for the help Clay. This worked well. I wouldn''t mind seeing this as a property in the columns collection. It would be nice to be able to handle this at design time.


AD Administrator Syncfusion Team November 28, 2005 11:44 PM UTC

If you are using DataTables as the datasource for the grid, you can set the DataColumn.DefaultValue property for each column to provide a default value and the grid will use this. This way, you do not have to handle an event.

Loader.
Up arrow icon