asp.net - C#: Changing code from Session to ViewState causing page refresh -
i have page contain usercontrols. theses uc have contents visible or not depending on click. page using sessions retain data database, this:
private viewpersoncollection collection { { if (session["viewpersoncollection.test1"] == null) session["viewpersoncollection.test1"] = new viewpersoncollection (); return (viewpersoncollection )session["viewpersoncollection.test1"]; } set { session["viewpersoncollection.test1"] = value; } }
since having problems session when clients using different tabs @ same browser, changed view state, this:
private viewpersoncollection collection { { if (viewstate["viewpersoncollection.test1"] == null) viewstate["viewpersoncollection.test1"] = new viewpersoncollection (); return (viewpersoncollection )viewstate["viewpersoncollection.test1"]; } set { viewstate["viewpersoncollection.test1"] = value; } }
but after change, page stopped loading usercontrols. if click on button, page gets reloaded. debugged , code running ok, reason main page being reloaded.
what doing it?
each user control uses own viewstate later merged page viewstate. anyways, viewstate isn't option big objects.
you can try using this.context.item collection shared between user controls , page, hold information in same http request.
Comments
Post a Comment