如何在回发时保留列表内容?
在我的网页的页面加载事件上,我用结构的内容填充列表。
Structure MainStruct
Dim Ans1 As String
Dim Ans2 As String
End Structure
Dim Build As New List(Of MainStruct)
问题是,在回发时列表的内容会丢失。
那么,如何在 ASP.NET 中保留 list-of 的内容呢?
On the page load event of my webpage i fill the list of with the contents of the structure
Structure MainStruct
Dim Ans1 As String
Dim Ans2 As String
End Structure
Dim Build As New List(Of MainStruct)
The problem i that on post-back the contents of the list-of get lost.
So, how can i preserve the contents of the list-of in ASP.NET?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不希望保留在数据库或 ASP.net 缓存等存储中,您可以将其放入会话或视图状态中。当然,如果您将其保留在会话中,则必须小心,因为一旦超出范围,您就必须立即清理它。另外,序列化/反序列化将是另一个角度。你不能为你的应用程序提供一些全局缓存吗?
You can either put it in a session or a viewstate in case you donot wish to keep in a storage like database or a ASP.net cache. Of course, you shall have to be careful if you keep it in session as you shall have to clean it up as soon as you go out of scope. Also, serialising/deserialising will be another angle. Can't you have some global cache or so for your app?