是否存在从 ASP.NET 中的 DataTable 获取数据的现有 DataSource?

发布于 2024-07-14 06:38:30 字数 384 浏览 11 评论 0原文

我正在制作一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提赋 2024-07-21 06:38:30

您所描述的场景;

  1. 从数据源检索数据并
    存储在数据表中
  2. 存储数据表
    处于会话状态。
  3. 修改数据表
    来自不同的网格

听起来它会起作用,我可以看到您遇到的问题是,当数据发生变化时,您必须在网格之间重新加载数据。 您必须编写一个类,在对数据表进行更改时引发事件(您可能还希望将其包含在类中,并将类对象存储在会话状态中)。

我希望数据表不要太大...因为这不是我对网络应用程序采取的方法。

The scenario you have described;

  1. Retrieve data from datasource and
    store in datatable
  2. Store datatable
    in session-state.
  3. Modify datatable
    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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文