This is a migrated thread and some comments may be shown as answers.

Adding row directly from Gridview

1 Answer 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yan St-Yves
Top achievements
Rank 1
Yan St-Yves asked on 21 Jun 2011, 10:02 PM
Hi,
I have a gridview populated from a List<> and i want to be able to modify, delete or to add a new row (by clicking on "Add new row " at the bottom of the grid) directly on grid . After the user fills out all columns, he will click on a save button outside the grid. Now, i want to know how to iterate between gridview rows to know wich rows were added an wich were modified, deleted....
And depeding on the row state, i'll do an insert, update or delete on the Database.

Thank u very much!

1 Answer, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 24 Jun 2011, 03:07 PM
Hello Yan St-Yves,

RadGridView is not responsible for tracking the state of each record. This is responsibility of your data source. For instance, the Microsoft DataTable class has GetChanges method returns deleted, added or modified rows. There is two approached two resolve your case:

  • You can use DataTable class instead of LIst<T> as data source
  • You should extend your data source to support tracking of its items' states by storing changed records in additional collections.

Regards,
Svett
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
Yan St-Yves
Top achievements
Rank 1
Answers by
Svett
Telerik team
Share this question
or