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
close icon

Adding new records to grid programatically

hi,
I am using GridGrouping control and using custom business entities to bind data.
I donot want the user to directly add the data to grid. therefore i have set the TableDescriptor AddNew property to false. However i want to be able to add a new record with some default data programatically, say on click of a button.
Can you help me on this urgently.

Thanks
Dinesh

1 Reply

AD Administrator Syncfusion Team February 12, 2007 09:02 PM UTC

Hi Dinesh,

Instead of setting the TableDescriptor.AllowNew property, try setting the ShowAddNewRecordBeforeDetails and ShowAddNewRecordAfterDetails property to false. And than You can use the AddNewRecord property of the GridTable to add new record in a grid. Please try the below code snippet and let me know if this helps.

this.gridGroupingControl1.Table.AddNewRecord.SetCurrent();
this.gridGroupingControl1.Table.AddNewRecord.BeginEdit();
this.gridGroupingControl1.Table.CurrentRecord.SetValue("ColumnName","Value");
this.gridGroupingControl1.Table.AddNewRecord.EndEdit();

Here is a sample.
GridAddNew.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon