在客户端存储数据的最佳方式 - ASP.Net + jQuery

发布于 2024-10-05 00:06:10 字数 491 浏览 4 评论 0原文

我正在为一些相当复杂的对象编写管理表单。它是一个标准中继器,显示每个对象行的一些“基本”信息(名称、ID 等)。

单击一行的“编辑”可将其展开(使用 JQuery),以揭示所有关联的可编辑对象的全部恐怖之处。其中之一是与每一行关联的文档列表,并且需要可 JQuery 编辑,以便用户可以单击“编辑”打开整行 gui,然后取消/选择复选框以取消/关联文档,然后单击“保存” ' 坚持一切。

目前,我正在使用嵌套转发器来存储最初隐藏的字段 - 转发器生成一个隐藏的表单字段,其中包含关联文档的以逗号分隔的 ID 列表。当涉及到填充编辑 gui 时,我对分隔字符串执行拆分操作,并根据需要设置/取消设置复选框。

从可维护性的角度来看,这证明是一场噩梦,在我沮丧地在网络上寻找解决方案时,我注意到 JQuery 有一些功能可以充当客户端数据库。有没有人有这方面的经验,如果有的话,你会推荐吗?我用来解析 csv 字符串并动态构建 GUI 的自定义 JS 开始让我有点沮丧。

提前致谢,

5arx

I'm writing an admin form for some fairly complex objects. Its a standard repeater which displays some 'basic' information (name, id etc.) for each object row.

Clicking 'Edit' for a row expands it (using JQuery) to reveal the full horror of all the associated editable objects. One of these is a list of documents associated with each row and needs to be JQuery-editable so the user could click 'edit' to open up the full row gui, then un/select checkboxes to de/associate documents and then hit 'Save' to persist everything.

Currently I'm using nested repeaters to store the initially-hidden fields - the repeater generates a hidden formfield containing a comma-separated list of IDs for the assoc documents. When it comes to populating the Edit gui I do a split operation on the delimited string and set/unset the checkboxes as required.

This is proving a nightmare from a maintainability perspective and in my frustrated wanderings of the web in search of a solution i noticed JQuery has some functionality to act as a client-side database. Does any one have any experience of this, and if so, would you recommend it? My custom JS to parse csv-strings and dynamically build the gui is starting to grind me down a bit.

Thanks in advance,

5arx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

痴梦一场 2024-10-12 00:06:10

您进入了非常高级的客户端行为领域,并且遇到了我认为很多 Web 表单开发人员都遇到过的现象。试图将两种范式相互融合。

在不涉及太多细节的情况下,我的建议是采用“纯 AJAX”方法来解决您的客户问题。基本轮廓是这样的:

您可以按照您认为最适合您需求的方式实现 JSON 内容,但在 ASP.Net 中您基本上有两个选择:

  1. WCF
  2. 页面方法

这可能需要您进行一些重新架构,但如果您想实现真正良好的客户端行为,您将不得不硬着头皮去做。

Your getting into the realm of very advanced client-side behavior, and are bumping into a phenomenon that I think a lot of Web Forms developers hit. Trying to mash two paradigms into each other.

Without going into a lot of detail, my advice would be to go with a "Pure AJAX" approach to solving your client woes. The basic outline is this:

You can implement the JSON stuff however you feel best suits your needs, but in ASP.Net you basically have two options:

  1. WCF
  2. Page Methods

It's probably going to involve some re-architecting on your part, but if you want to achieve really nice client-side behavior you are going to have to bite the bullet and just do it.

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