是否存在从 ASP.NET 中的 DataTable 获取数据的现有 DataSource?
我正在制作一个 ASP.NET Web 窗体应用程序。 我想要一个 DataSource,它从 DataTable 中获取数据,并且该表在请求中保留(最好是在会话中,而不是 ViewState)。
这个想法是需要一些相当复杂的表单,其中每个表单都有多个网格视图。 所有网格视图都必须具有编辑功能(我们正在使用 DevExpress),但表单上必须有一个巨大的“保存”按钮,用于保存所有内容。
因此,如果我可以获得某种可以将这些 GridView 绑定到的 DataSource,并且该 DataSource 只会将数据存储在内存中,那就太好了。 当用户单击“保存”按钮时,我将手动查询这些数据源并从中提取更改的数据。
是否有这样的东西,或者我必须自己编写(似乎是一项相当大的任务)?
I'm making an ASP.NET Web Forms application. I would like to get a DataSource which takes its data from a DataTable, and this table is persisted among requests (preferably in session, not ViewState).
The idea is that there is a need for some fairly complex forms where there are several gridviews in each of them. All the gridviews have to have edit functionality (we're using DevExpress), but there has to be one giant "SAVE" button on the form, which saves everything.
So it would be nice if I could get some kind of a DataSource that I could bind these GridViews against and which would only store the data in memory. When the user clicks the Save button I would then manually query these DataSources and extract the changed data from them.
Is there something existing for this, or must I write my own (seems to be a pretty large task)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所描述的场景;
存储在数据表中
处于会话状态。
来自不同的网格
听起来它会起作用,我可以看到您遇到的问题是,当数据发生变化时,您必须在网格之间重新加载数据。 您必须编写一个类,在对数据表进行更改时引发事件(您可能还希望将其包含在类中,并将类对象存储在会话状态中)。
我希望数据表不要太大...因为这不是我对网络应用程序采取的方法。
The scenario you have described;
store in datatable
in session-state.
from different grids
Sounds like it will work, issues that i can see you having is that you'll have to reload the data between grids when the data changes. You'll have to write a class that'll raise events when changes are made to the datatable (which you'll probably also want to include in the class, and just store the class object in session state).
I hope the datatable isn't too too big... as this isn't the sort of approach i'd take for a web app.