网页是无状态的,一旦执行完,到了IE客户端,服务端的页面对象全部消失。必须将你需要的保存好,下次进入这个页面中才能使用。将ArrayList对象放入 ViewState 中保存private ArrayList arrayList { get { object o = ViewState["ArrayList"]; if( o == null ) { o = new ArrayList(); ViewState["ArrayList"] = o; } return o as ArrayList; } }或者放入 Session, Application 中
{
get
{
object o = ViewState["ArrayList"];
if( o == null )
{
o = new ArrayList();
ViewState["ArrayList"] = o;
}
return o as ArrayList;
}
}或者放入 Session, Application 中
2.用viewstate记住arraylist.
Session
Cache
Application (全局的)
当然viewstate session cookie 均可