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.

Default Data in Add New Row

Thread ID:

Created:

Updated:

Platform:

Replies:

37663 Nov 28,2005 02:54 PM Nov 28,2005 06:44 PM Windows Forms 3
loading
Tags: Grouping
Peter Titus
Asked On November 28, 2005 02:54 PM

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.

Administrator [Syncfusion]
Replied On November 28, 2005 03:22 PM

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");
	}
}

Peter Titus
Replied On November 28, 2005 05:17 PM

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.

Administrator [Syncfusion]
Replied On November 28, 2005 06:44 PM

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.

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.

;