标签:
//首先定义
Hashtable myHach = new Hashtable();
//添加键值到Hashtable中
myHash.Add("ServiceType1", "值");
//例:
myHash.Add("Account1", this.txtAccount1.Text.Trim());
//把Hashtable放入ViewState[""]里
ViewState["condition"] = myHash;
//取得Hashtable的值
Hashtable ht = (Hashtable)ViewState["condition"];
//判断Hashtable中是否存在对应键
if(ht.ContainsKey("ServiceType1"))
//如果存在就把值赋给字符串
string ServiceType1 = ht["ServiceType1"].ToString();
标签:
原文地址:http://www.cnblogs.com/azhou/p/5323783.html