Hello all,
I have a GridView that allows editing the values in every column, in every row, all the time. The user enters in all their changes, clicks Save once and all changes are commited.
The user must also be able to click the New button, have a new row appear in the GridView (yep, it has to show up in the actual GridView), enter whatever data they want, click Save and have all changes go to the database.
Now. Here's the user case that's throwing me: a user arrives at the page, makes several changes on several existing rows, and then needs to add a new row, enter data in the new row, click Save, and have all changes go to the database.
However, the only ways I've seen to add a new, empty row involve rebinding the GridView, which means all of their changes will be lost. This is obviously no good.
So, my question would be: what are some approaches to adding a new, empty, editable row to a GridView without having to rebind the GridView?
The only thing I can think of would be, on the New buttons' click event, suck all the data out of the GridView (including the user's potential edits), save it to ViewState (or whatever), add the new row, repopulate the grid. This, to me, seems a little hacky, but it should allow me to turn ViewState off on the GridView.
Any ideas?