Link to home
Start Free TrialLog in
Avatar of sbornstein2
sbornstein2

asked on

ASP.Net - How can I keep my whole page with grids in viewstate or cache page?

Hello all,

I have a tabbed page where when the user goes to a second tab and back to the first the grids reset and all the dropdowns go back to defaults etc.  Is there a way to somehow cache the page or viewstate etc. the controls?   I need some detailed information so I can try it thanks all.  Just for the day is fine I guess if caching is the way to do it or like a few hours or something.  I just want the user to be able to go to two tabs on that page and it keeps the control selections somehow.
Avatar of sybe
sybe

How do you do the tabbing? Because it sounds as opening a tab is a roundtrip to the server.

You can do tabbing also with hiding and displaying divs through javascript (without doing a roundtrip to the server).
Avatar of sbornstein2

ASKER

The tabbing really is just a control that actually loads an ASPX page so it really is like a redirect the page completely reloads.  So on the page that I want cache only the first tab (again it just goes to its own aspx page and the tab control is on both aspx pages) on the page I want cache or viewstate whatever I have gridviews that have checkboxes in them three gridviews in total and then two dropdowns.  When the user goes back to the page I want those values to stay somehow.  Is there a way to cache the whole page or is it harder than that and I need to cache all the checked checkboxes, selected values etc?
So you want to keep the viewstate of two different pages as if it were a single page? That is going to be hard. And if you maybe are going to add more tabs in the future, things are getting only more complicated.

You could read the viewstate of page1 from the Request.Form and store it in a hidden formfield in page2, and then with javascript - when going back to page1 - exchange the stored value of the viewstate of page1 with the viewstate of page2 that is posted. But I don't know if it is possible to manipulate the viewstates that way. And you might quickly get an enormous viewstate in the pages.

Or you could read out all relevant formvalues (how many are there?) from page1 and store them in a hidden form field in page2, read them out when going back to page1.

Isn't is a lot easier to have the tabs with hiding/displaying divs with javascript? I think it is.



well my tabs look very good based on the control I found where I can set the style settings etc.  Not sure what other tab control I could use to handle that.  Right now this tab control dll I found will direct to another page.
most of the tab controls I have found even the ajax control kit they all post to another URL.
Hmmm. I start to think that we are living on a different planets. In my world styles are done by CSS directly, not by setting styles to a control, which then translates them to CSS while the control is translated to HTML.

Maybe it is a bit hard to explain that I do like the freedom of writing HTML, CSS and javascript directly, that it is not that hard and that asp.net does not need to process directly written HTML, CSS and javascript.
I am using thw following control set http://www.codeproject.com/KB/custom-controls/FormTabs.aspx.  This as well as other tab controls I have found postback to a different URL per tab.  So unless you know of a client side one that would help great otherwise I need to somehow store the checked values of grids and controls.  That is the point of my question.
ASKER CERTIFIED SOLUTION
Avatar of sybe
sybe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I ended up using the Ajax Control Kit and it's tab control with content containers now on one page.