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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Adding new records to grid programatically

Thread ID:

Created:

Updated:

Platform:

Replies:

56265 Feb 12,2007 08:33 PM UTC Feb 12,2007 09:02 PM UTC WinForms 1
loading
Tags: GridControl
dinesh upreti
Asked On February 12, 2007 08:33 PM UTC

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

Administrator [Syncfusion]
Replied On 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

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.

Warning Icon 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.Close Icon

;