0

I have a GridView which I am binding to my service layer.

I want to be able to allow the user to edit the grid, but I do not want to save the grid as the user is clicking update on each row. I would like to update all of the edited/added/deleted rows when the 'save' button for my entire form is submitted.

I have my service layer configured, and the GridView calls update on a per row edit basis, however I want that to happen all at the end when clicking save.

How can I maintain my ObjectData sources references to update, insert, delete but instead of on a per row basis be able to call a save on everything all at once?

Thanks!

4

2 回答 2

0

这是关于在事务中包装更新的 asp.net/learn 教程:

http://www.asp.net/Learn/Data-Access/tutorial-63-cs.aspx

该示例使用 GridView 和 ObjectDataSource。这可能对亚音速有用也可能没有用,但它可能会帮助其他有类似问题的人。

于 2009-11-11T05:10:22.877 回答
0

如果您使用的是对象数据源,那么绑定到对象数据源的对象的行为取决于您;它不必立即保存到数据库中。如果需要,您可以构建要执行的数据库命令,然后将它们缓存在某处,直到单击保存按钮。

对象数据源对象应该是静态的或无状态的,所以你不能在那里缓存。但是,这听起来像是合理使用 Session 缓存。

于 2009-11-11T01:15:55.823 回答