Last post May 01, 2012 02:03 PM by Erik Brink
Apr 26, 2012 02:45 PM|Erik Brink|LINK
In my ASP .NET application I use a tabpanel to let the user open multiple subject from a quickbar, like browser tabs but then inside my application. The content of the subjects is dynamically created server-side. To remain the viewstate of inactive tabpages
I need to rebuild the content of the inactive tabpages every request again. When the user opens more subject very request to the server will take longer and longer because of this.
I'm looking for an advanced solution to save the viewstate of inactive tabpages over multiple requests on the active tabpage. When an inactive tabpage becomes active again I want to put the saved viewstate of this tabpage back in the viewstate of the whole
page. This can give my application a performance boost when I do not need to rebuild every inactive tabpage on every request to the server.
I have red a lot about the ASP viewstate but I did not found a solution for this yet. Any suggestions how I can accomplish this?
Apr 28, 2012 09:32 AM|roopeshreddy|LINK
Once the content is created, you can store the content in the session instead of storing in ViewState! Since you have mutliple subjects and storing those many in ViewState may be burden on the page!
Instead you can store in the session for particular subject and update that accordingly! If anctive tab becomes active, you can get the data from the session and update it!
Hope it helps u...
May 01, 2012 10:17 AM|Erik Brink|LINK
Yes that was my idea too, but how can I accomplish this technical. I need to create a new viewstate for the page with its current viewstate and merge the viewstate of the inactive tab that becomes active again into it or something.
Another option is, when the tab change event fires, that I can provide the new active tab component its own viewstate back which was saved in the session for a couple of requests.
I don't know how I can accomplish this in my code...
May 01, 2012 10:30 AM|roopeshreddy|LINK
Don't create ViewState. Store data in Sessions. For every tab change event, then update the tab content with the data in the session based on the tab!
May 01, 2012 02:03 PM|Erik Brink|LINK
Thanks for your quick reply!
The viewstate belongs to the page. Accept the viewstate of the tab content there is viewstate of my quickbar and the tappanel itself(selected index) that I want to remain every request.
When a tabchange event happend this is what happends:
1. build page with old selected tab content
2. Load viewstate for the page
3. User event fires(tab change)
4. Build up new selected tab. Now I need a part of the viewstate for the tab content from the session.
How can I accomplish this in code? In which method/event can I provide the viewstate from the session so that the framework will call loadViewState with the correct values on the tab content controls?