更新gridview的所有行gridview

2023-09-04 01:19:16 作者:一夕意相左

我有一个gridview,两个按钮(编辑,保存),什么我想要做的是:

i have a gridview,two buttons(edit,save) ,what i wanna to do is :

当点击编辑打开的GridView在编辑模式下所有的文本框。

when click edit open the gridview in edit mode for all the textboxes.

当点击保存需要修改和更新

when click save takes the changes and update

(而不是编辑和更新逐行)

(rather than edit and update row by row)

我使用对象数据源。

推荐答案

A 的GridView 是不是真的换货一次修改的所有行。要做到这一点,它实际上没有那么简单。如果你想,虽然做到这一点,看看下面的文章:

A GridView is not really ment to edit all rows at once. To do so it's actually not that straight forward. If you want to do it though, check out the following article:

真实世界GridView控件:批量编辑

我会建议不使用的GridView 和使用转发来显示您的数据。然后,当你想要编辑,使用不同的页面(或面板采用了不同的转发),以显示你的编辑控件。您的code会有很多更容易维护与此解决方案。

I would recommend not using a GridView and using a Repeater to show your data. Then when you want to edit, use a different page (or a panel with a different Repeater) to display your edit controls. Your code will be a lot more maintainable with this solution.

您没有解释为什么你需要一次这样无论是方法之一上述解决方案应该工作的编辑都行。

You didn't explain why you need to edit all rows at once so either way one of the above solutions should work.