请问要怎么保持List的状态..
不知道怎么表达..看代码应该明白了.程序代码:
public partial class operate : System.Web.UI.Page { private int id = 0; private List<Model.Keys> lists = null; public operate() { lists = new List<Model.Keys>(); } protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(Request.QueryString["id"].ToString(), out id)) id = 0; if (!IsPostBack) { lists = new SQLserverDAL.KeysDAL().Items(id, false); this.list.DataSource = lists; this.list.DataBind(); } } protected void ReMove_Click(object sender, CommandEventArgs e) { int id = Convert.ToInt32(); lists.Remove(new SQLserverDAL.KeysDAL().Item(id)); this.list.DataSource = lists; this.list.DataBind(); } } }
目点是想实现在ReMove_Click中移除指定的项,但结果是到ReMove_Click中时lists就已经为空了.请问要怎么更改或有其它方法代替..
[[it] 本帖最后由 wggfcusmq 于 2008-7-31 16:09 编辑 [/it]]