简体   繁体   English

存储临时数据的最佳方法是什么?

[英]What is the best way to store temporary data?

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). 我正在使用Telerik控件,我希望用户能够从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. 这个RadGrid G2位于另一个网格(G1)的弹出窗口中,因此我要避免在用户实际单击G1上的Submit之前将信息写入数据库。

I was thinking that whenever the user makes changes to G2, that I would update a temporary data table and bind that to G2. 我当时想,只要用户对G2进行更改,我都会更新一个临时数据表并将其绑定到G2。 I wasn't sure if this was the best approach, or if there was a more efficient way. 我不确定这是否是最好的方法,或者是否有更有效的方法。

Thanks. 谢谢。

You could write the ids to be deleted on a hidden html input text element (make it runat=server ). 您可以在隐藏的html输入文本元素上编写要删除的id(使其成为runat=server )。 When the user clicks Submit you take the value of the hidden html element and delete the IDs present there. 当用户单击“ Submit您将获取隐藏的html元素的值并删除其中存在的ID。

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. 注意:这绝对不是一种安全的方法,因为用户可以手动操作html元素的值,并且最终可能会意外删除某些内容。 You need to evaluate if this is a security risk or not for your scenario. 您需要评估这是否对您的方案构成安全风险。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM