views:

477

answers:

3

How Can I find all the rows that has been changed in gridview. I can not use Ajax in any form

+1  A: 

First get the contents of your grid before it was changed (such as caching the results of the original gridview datasource binding). Then go through the dataset/datatable/however you want to store it, and compare the contents with the current rows of the gridview.

TheTXI
+1  A: 

There's no real efficient way to do this, no method like GridView.GetAllChangedRows(). So, what you might do instead is keep a behind the scenes List that you add to each time a row is modified (use the RowUpdated method), then clear this list when needed.

Matthew Jones
A: 

It depends upon how many columns you want to edit in a row. If you have only one editable column in a row then you can associate a javascript method with that control which you want to modify and in that method you can get a rowid. which you can save in another hidden field and in server side you can get all rows whose ids are stored in hidden field. If you have whole row editable in that case the best approach I think you should save the original data source somewhere and also set a javascript method with rowclick event to get rowid which user selects. Then when user clicks on submit button get all rows whose row ids are stored in hidden field then compare those with same rowid in datasource. This is the best approach from my point of you. Let me give you an example, suppose there are 1000 rows in a grid and user clicks on only 180 rows. In that case we will compare only 180 rows and wont compare rest of the rows. Please let me know if somebody has better idea then this. My mail id is - [email protected]

tarun