开发者

How to save multiple rows on data grid

开发者 https://www.devze.com 2023-02-17 12:11 出处:网络
Let\'s say I have ten rows on a data grid and I have changed data of three rows. I am trying to save data by Linq for those three rows, but I am not sure how it is possible to save them.

Let's say I have ten rows on a data grid and I have changed data of three rows.

I am trying to save data by Linq for those three rows, but I am not sure how it is possible to save them.

I can do it by looping whole rows by开发者_高级运维 checking each row for any change.

Is there any smarter way to save multiple data rather than looping by code, such as For Next.


As long as the Data Context is kept alive while the changes are made in the grid, you can save all of the changes by calling SubmitChanges() using the Unit of Work pattern. This works fine in stateful (Winform/WPF) implementations. In web applications, the typical UI models only allow for editing a single row per page submission. In that case, the challenge becomes how to allow editing multiple records in a single page request. If you can do that, then you can batch up your updates and only call SubmitChanges once per page request.

0

精彩评论

暂无评论...
验证码 换一张
取 消