Welcome to L-Space Design Forums Sign in | Join | Faq

ASP.NET

Started by admin at 06-22-2005 16:02. Topic has 0 replies.

   

Print Search
Sort Posts:    
   06-22-2005, 16:02
admin is not online. Last active: 1/13/2011 6:56:05 PM admin

Top 10 Posts
Joined on 06-16-2005
Auckland, New Zealand
Posts 63
Reducing the ViewState size in ASP.NET applications

I've been having an interesting discussion with a developer who was trying to use Bandwidth Buddy to reduce the size of the traffic between the web server and browser.  As it turns out, what they were after was slightly different in purpose, but the discussion was quite useful, so we'll continue it here.

> Thanks for your answer.
>
> At this moment I looking for a solution to compress the viewstate transfer,
> indeed it is huge. So I only watch the "View Source" from the browser, save
> as and finally compare the file size generated, because when you made some
> postback the viewstate travels again to and from the server.

Traffic from the browser to the web server is never compressed
(not part of the HTTP standard), and you won't see any effect
on the viewstate for two reasons, one is that you will only ever be seeing the
view state after it has been uncompressed.  and the other is that the view state
is already compressed before it is converted into the text you see. in the page source

The best way to reduce the size of the viewstate is to set enableViewState = false
on any controls that don't actually need it, and to plan carefully.

For instance, if you are using a data grid that does not allow editing and where
'selecting' an item takes you to another page, you can replace the link buttons
with hyperlinks, disable the viewstate for the grid, and rebind it each time
the page is shown.  If it does use editing, you can make use of a paging
control (plenty around)  to track your location in the records, and only bind a
single page of data to the data grid at a time.

 


Roger Willcocks
Software Engineer MSCD.NET
L-Space Design
http://www.l-space-design.com/
"Putting your experience to work"
   Report 
L-Space Design ... » Software Develo... » ASP.NET » Reducing the ViewState size in ASP.NET applications

   

Powered by Community Server, by Telligent Systems