Hi
While working on one of personal project there was requirement to hold the collection of data of some event and again i have to validate that data on some other event, then i did using Viewstate like this sample code
protected void Button1_Click(object sender, EventArgs e) { ViewStateList.Add(1); ViewStateList.Add(5); } protected List<int> ViewStateList { get { if (ViewState["Record"] == null) ViewState["Record"] = new List<int>(); return (List<int>)ViewState["Record"]; } } protected void Button2_Click(object sender, EventArgs e) { foreach (int n in ViewStateList) { Response.Write(n); } }
I hope this will help to somebody.
This is my first time pay a visit at here and i am truly happy to read all at alone place.