在asp.net中使用集合类作为数据源的问题
我正在使用集合类作为 gridview 的数据源。请从 http://nopCommerce.com 下载 nopCommerce 源代码。我正在遵循同样的方法。
我已经创建了我的提供程序和集合类,用作 gridview 的数据源。 数据完美绑定。问题是我必须自定义 gridview 的所有事件,例如“RowDeleting”、“RowUpdating”、“RowCancellingEdit”等。最重要的是,如果我单击编辑、更新或选择按钮,页面会回发。
有人可以提供适当的解决方案吗?
感谢您分享您的时间。
问候 穆罕默德·伊尔凡
I am using collection class to work as datasource for gridview. Please download nopCommerce source from http://nopCommerce.com. I am following the same approach.
I have created my providers and collection classes being used as datasources for gridview.
The data is binding perfectly. The problem is that i have to customize all the events for gridview like "RowDeleting", "RowUpdating", "RowCancellingEdit" etc. Above all the page is postback if i am clicking on edit, update or select buttons.
Can someone provide proper solution.
Thanks for sharing your time.
Regards
Mohammad Irfan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有看到任何无法正常工作的地方。因为集合是一个“简单”对象,所以您必须实现这些方法,因为 GridView 不知道如何对对象集合进行这些更改。
您可能会考虑创建自己的数据源控件 。
I don't see anything that isn't working correctly. Because a collection is a "simple" object you have to implement these methods as the GridView does not know how to make these changes to a collection of objects.
You might think about creating your own DataSource control.
您是否在绑定数据之前检查页面是否正在回发?
IE:
Are you checking if the page is posting back before you Bind your data?
i.e.: