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

How to allow to user to add records to GCC?

Hi,

I want to provide user with a ability to add records (initially empties) to the GCC.
User will be able to press some small button in the GCC and add empty record. Then user can either fill it and save or switch to another grid (hide the whole grid and show another one). In case that user will return to the first grid, added records will be preserved. Any ideas?
I would greatly appreciate your help in this issue.
Best Regards,
Vladimir

3 Replies

RC Rajadurai C Syncfusion Team May 20, 2009 02:29 PM UTC

Hi Vladimir,

Thanks for your interest in Syncfusion products.

Please refer to the following sample in which this has been implemented.
http://files.syncfusion.com/support/samples/Grid.Windows/7.2.0.20/F81384.zip

In this sample, two datatables have been used. At runtime, new rows are added to the grid and editing can be made. When the second datatable is binded to the same grid, the rows which are added before remains saved in the first datasource. On rebinding the first one, the grid get loaded with saved(newly added) records.

Regards,
Rajadurai


VS Vladimir Shcherbina May 20, 2009 04:19 PM UTC

Hi,

Many thanks for your answer.
Actually I don't need to svae newly added record to the database yet. I need to know the following:

1) Which GGC callback (if any) will be called (and can it be overriden?), if user adds new record
2) Why GCC is not saving this record automatically. Every time that I switch to another grid and return back (by hiding the previous one and showing the new one) the added record is disappearing. How to change this behaviour withour updating GGC datasource?

Many thanks for your answers.
Best Regards,

Vladimir


RC Rajadurai C Syncfusion Team May 22, 2009 09:31 AM UTC

Hi Vladimir,

Thanks for your update.

1) The SourceListRecordChanged and SourceListListChanged events get triggerred once a new record has been added or a change to a record is made at grid level. Please refer to the following event handlers.

this.gridGroupingControl1.SourceListRecordChanged += new RecordChangedEventHandler(gridGroupingControl1_SourceListRecordChanged);
this.gridGroupingControl1.SourceListListChanged += new TableListChangedEventHandler(gridGroupingControl1_SourceListListChanged);


2) GridGroupingControl is a bounded one. When you made any changes in the grid, the underlying datasource get updated and it reflects the update in grid on leaving the current record after editing. This is the behavior of gridgroupingcontrol. Here the underlying datasource get updated means only the datastore binded to it. The original datasource cannot get updated by default. Hence after rebinding the grid with same datasource or closing the grid window and reopening, the data which are displayed initially in grid get displayed.

Switch to another grid and return back- will it mean changing datasource binded to grid or two seperate grids? Because hiding one grid and showing the other , doesn't make the grid to lose any change made into it.

Regards,
Rajadurai

Loader.
Live Chat Icon For mobile
Up arrow icon