views:

637

answers:

3

So basicaly I am working on a site that is attempting to be optimized for phones (This includes pretty much any browser enabled phone) Due to the nature of the site, I want it to load as quickly as possible. At this point, I think the page is around 30k or so in size.

Now I am using viewstate, mostly for things like datagrids and not "saving" any fields to it myself.

I've seen a lot of examples like this (I swear not my blog) with 2.0 in mind , but nothing dealing with 3.5 which makes me wonder if nothing has changed since then or compressing the viewstate has fallen out of favor.

Question is, should I bother trying to compress the viewstate or is there a better solution?

+1  A: 

I don't think it has fallen out of favor just that saving the view state in 2.0 should work the same as saving it in 3.5. The best way to reduce viewstate is not to use it, but this is not always feasible.

In those cases you should experiment the tradeoff of bandwidth vs the extra processing time that will be required on the server. The only way to know if its worth it is to do it and measure the impact.

Edit

Another option I have seen is to save the view state on the server. It could be saved in memory, a database or disk. Depending on your environmental requirements. This would be the greatest savings on bandwidth.

Here's a code project article
Looks like a good article

JoshBerke
A: 

Having ViewState is contrary to having a fast loading web page. Why do you need ViewState? Reconsider your design and use as little as possible. I would put the burder of Session data on the server and/or database until there is a reason to keep some data in ViewState.

ka3751
The ViewState has it's place (and then some), but to advocate not using it at all is too extreme IMO. It's invaluable for storing identity keys that you don't want stored in hidden fields on the page (which the nefarious user can tamper with). Now, if you're storing entire DataSets or such in it, then, yeah, you need to rethink your game plan.
Jagd
+2  A: 
Joel Coehoorn