问题
What is the best way to achieve bulk editing of a grid view in ASP.net? I don't want the user to have to click edit on each individual row to change it. It would be much better if they could make all the changes and then submit them in one go.
What I want is something like
Item1 x x x x
Item2 x x x x
Item3 x x x x
Submit
Where x a check box.
Is a grid view even a good way to go about achieving this?
回答1:
Try this:
In you gridview create a template column with textboxs next fill all with databinder for get default data from database. put a bottom your page and in this bottom create a for cycle that load all gridview rows and search for template column you created. Fin the textbox a write this to dataset. Next you can use my code i posted in this thread for with one line save all dataset.
回答2:
BulkEditGridview from RealWorldGrids does just what you want.
回答3:
Here is a GridView that supports bulk editing: http://blogs.msdn.com/b/mattdotson/archive/2005/11/09/real-world-gridview-bulk-editing.aspx
回答4:
I wonder if Matt Berseth´s post about bulk inserting (in a listview but it might help you) could be of some assistance, try it:
http://mattberseth.com/blog/2008/05/bulk_inserting_data_with_the_l.html
回答5:
You should be able to set the GridViewRow.RowState to Edit during RowDataBound. Just be sure the RowType is DataRow.
来源:https://stackoverflow.com/questions/902943/bulk-editing-of-a-gridview-in-asp-net