我的属性值没有取到,帮我看看
在一个类里定义
public string StaffCode
{
set
{
ViewState[ "_staffcode "] = value;
_staffcode = ViewState[ "_staffcode "].ToString();
}
get {
if (ViewState[ "_staffcode "].ToString() == " ")
{return " ";}
else
{
return ViewState[ "_staffcode "].ToString();
}
}
}
A页面副值,B页面却取不到值.帮我看看
------解决方案--------------------两个页面用viewstate可能取不到
改成session
public string StaffCode
{
set
{
Session[ "_staffcode "] = value;
_staffcode = Session[ "_staffcode "].ToString();
}
get {
if (Session[ "_staffcode "].ToString() == " ")
{return " ";}
else
{
return Session[ "_staffcode "].ToString();
}
}
}