存储临时数据的最佳方式是什么?
这是我的情况:
我正在使用 Telerik 控件,我希望用户能够从 RadGrid (G2) 添加和删除信息。此 RadGrid G2 驻留在另一个网格 (G1) 的弹出窗口内,因此我希望避免将信息写入数据库,直到用户实际单击 G1 上的提交。
我在想,每当用户对 G2 进行更改时,我都会更新临时数据表并将其绑定到 G2。我不确定这是否是最好的方法,或者是否有更有效的方法。
谢谢。
Here is my situation:
I am using Telerik controls and I would like the user to be able to add and delete information from a RadGrid (G2). This RadGrid G2 resides inside a popup window from another grid (G1), so I want to avoid writing information to the database until the user actually clicks submit on G1.
I was thinking that whenever the user makes changes to G2, that I would update a temporary data table and bind that to G2. I wasn't sure if this was the best approach, or if there was a more efficient way.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将要删除的 id 写入隐藏的 html 输入文本元素(使其成为
runat=server
)。当用户单击Submit
时,您将获取隐藏 html 元素的值并删除其中存在的 ID。注意:这绝不是一种安全的方法,因为用户可以手动操作 html 元素的值,并且您最终可能会意外删除某些内容。您需要评估这对于您的场景是否存在安全风险。
You could write the ids to be deleted on a hidden html input text element (make it
runat=server
). When the user clicksSubmit
you take the value of the hidden html element and delete the IDs present there.Note: This is not by any means a secure way of doing this since the user can manipulate the value of the html element manually and you may end up deleting something unintended. You need to evaluate if this is a security risk or not for your scenario.