MycleBypezece
New Member
I am trying to understand the lifecycle that is taking place here. I have a asp list view where I get item ids and write them to a list like so.\[code\] protected void ShareWith_OnItemBound(object sender, ListViewItemEventArgs e) { if (!IsPostBack) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem currentItemId = (ListViewDataItem)e.Item; System.Web.UI.WebControls.DataKey currentDataKey = this.lvShareWithPanel.DataKeys[currentItemId.DataItemIndex]; int FriendId = Convert.ToInt32(currentDataKey["SharedUserId"]); CurrentList.Add(FriendId); } } }\[/code\]Where my list is defined outside the method\[code\]private List<int> CurrentList = new List<int>();\[/code\]after, the user adds some new items to the list then click on an asp button to continue. I am running a comparison of the current list versus the new one but observing in debug after the button click I find that my list "CurrentList" is now empty. Why might the list, which is outside any method, be effected? Thanks for the help understanding