sessionState模式下的CheckListBox = InProc

时间:2016-06-06 18:02:27

标签: c# asp.net

我需要你的帮助, 我有一个checkBoxList项目存储在会话中,它会告诉我哪些项目被选中,哪些项目没有,我确实看到了这些项目,但我不知道如何检索它们。谢谢。检查我的代码 Web.Config中

<sessionState mode="InProc"

UserObject

namespace UsertManagement.Web
  {
/// <summary>
/// Role element.
/// </summary>
[DataContract(Namespace = ServiceNamespaces.Common)]
[Serializable]
public class USERObject : ICloneable
{
    /// <summary>
    /// Sets/gets checklist app.
    /// </summary>
    [DataMember]
    public List<string > CheckListApp { get; set; }
    /// <summary>
    /// Get the copy of current object.
    /// </summary>
    /// <returns></returns>
    public USERObject  Clone()
    {
        return new USERObject
        {
            CheckListApp = this.CheckListApp 
        };
    }
}
   }

我如何存储CheckListApp

USERObject userobject = new USERObject { CheckListApp = GetAppValues(true) };

的GetValues

 private List<string> GetAppValues(bool selected)
    {
    List<string> vName = CheckListApp.Items.Cast<ListItem>().Where(x => x.Selected == selected).Select(x => x.Value).ToList();

            return vName;
        }

0 个答案:

没有答案