Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
200
How to synchronize ultragrid with dataset?
posted

 I have an ultragrid, it is bound to a bindingsource, the bindingsource is created from a dataset.Let's say, I have 1 row in the dataset, so 1 row displayed in the ultragrid, then I inserted 2 new rows, then I delete one of them, now there are 2 rows in the ultragrid, but when I try to save the data into database, there are still 3 rows in the datatable of the dataset, and two of them are new created with the RowState=DataRowState.Added. So who can tell me how to synchronize the ultragird with the dataset behind it?

the ultragrid is bound to dataset in the following way!

 BindingSource bindingSource= new BindingSource(DataSet, DataTableName);

Ultragrid.DataSource=bindingSource;

 

  • 469350
    Offline posted

    This really has nothing specifically to do with the grid. The DataSet tracks all changes to your data source, so if you add a row and then delete that row, it tracks both operations. The DataAdapter generally handles this when updating the back end, but the grid really has no involvement in that process.

  • 18495
    posted

    Hello rajathan,

    Instead of using a BindingSource, try binding the grid directly to the DataSet and then set UltraGrid.DataMember to the name of the table.  You might find that works better.  Please let me know if you have any other questions about this issue.