如何在Asp.Net的单个Session中存储多个值...? [英] How Store multiple values in single Session in Asp.Net...?

查看:113
本文介绍了如何在Asp.Net的单个Session中存储多个值...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Example:
If i have 10 check boxes and i want to add those which are checked then store checked check boxes values in single Session.

推荐答案

您可以将它们保存为以逗号分隔的字符串,稍后当您从会话中获取时,将它们拆分并选中那些复选框(如果需要)。
You can save those as comma separated string, and later when you get from session , split them and check those checkbox (if needed).


对于一组布尔值,你可以使用Flags Enum。然后,您可以在Session变量中有效地存储单个整数值。最简单的是稍后将其翻译回Enum。
For a set of booleans, you could use a Flags Enum. Then you effectively store a single integer value in your Session variable. It's also easiest to translate back to the Enum later.


这篇关于如何在Asp.Net的单个Session中存储多个值...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆