Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 17th, 2007, 04:04 AM
Registered User
Join Date: Oct 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Server Side Viewstate in ASP.NET 2.0

Plz someone tell me what are the drawbacks and advantages of Server Side viewstate in asp.net2.0. will it help me in inceasing the performance of my project.
Vikas Patyal.

Old December 18th, 2007, 12:26 AM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

Pro: Reduces the weight of the page by not sending what can amount to a lot of data in the hidden viewstate field.
Con: Requires server memory. Depending on your user base this could have a large impact. Also consider ramifications in a web farm environment.

In general, you can often reduce your viewstate by simply doing some optimization of your pages. Many of the controls don't need viewstate. Others can be reworked a bit to eliminate the need for viewstate on controls that initially do require it. One good example is paging in a datagrid/gridview. The page number is part of viewstate. However, so is all the data for the current page. It isn't necessary to carry all the data in viewstate to make paging work, however because the data and page number are all in viewstate you have to have it enabled. Instead of relying on the internal page number, you can instead save the page number to a separate hidden field and handle it yourself. This can significantly reduce your viewstate by removing the grid's data from it.

Another way to reduce viewstate can be to use ajax. If you break up the page into update panels you can isolate those that actually need to change and only generate traffic for those elements that need to update.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with asp server side validation nkodali Classic ASP Basics 0 July 16th, 2007 04:02 PM
Dialogs in ASP.NET using server-side-blocked-calls inchl ASP.NET 1.0 and 1.1 Basics 1 September 27th, 2006 08:41 PM
ASP.NET Server Controls and Client-Side Scripts LoneStar1 BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 5 March 15th, 2006 05:51 PM
ASP.NET server side controls me_shriram VS.NET 2002/2003 3 August 11th, 2003 03:55 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.