How to keep viewstate small?

  • Thread starter Thread starter Arjen
  • Start date Start date
A

Arjen

Hi,

How do I keep the viewstate small?
I think I'm only using it for redirection (String)ViewState["UrlReferrer"].

Thanks!
Arjen
 
easy way to decrease viewstate is to disable it on controls that arent used
specifically during a postback. ie. if a datagrid is only displaying data and
not being used for updates and such it can safely be disabled and will
decrease viewstate size.
In short go through your page by control and determine if each control is
being requested during your post backs if not disable viewstate
 
When I have made my own paging control, let's say that I click on the 'next
page' button.
This event will update my list, does the list and the 'next page' button use
viewstate?

Thanks!
Arjen


werD said:
easy way to decrease viewstate is to disable it on controls that arent
used
specifically during a postback. ie. if a datagrid is only displaying data
and
not being used for updates and such it can safely be disabled and will
decrease viewstate size.
In short go through your page by control and determine if each control is
being requested during your post backs if not disable viewstate

Arjen said:
Hi,

How do I keep the viewstate small?
I think I'm only using it for redirection
(String)ViewState["UrlReferrer"].

Thanks!
Arjen
 
Anything that stores data will hold viewstate, which is most controls. The
GridView, for example, will store every row in ViewState. This allows you to
load once and have it persist through multiple postbacks (changing drop
downs, button clicks, etc.).

Realize if you turn off ViewState, to keep it small, you will have to
repopulate any controls that hold data.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************
Arjen said:
When I have made my own paging control, let's say that I click on the
'next page' button.
This event will update my list, does the list and the 'next page' button
use viewstate?

Thanks!
Arjen


werD said:
easy way to decrease viewstate is to disable it on controls that arent
used
specifically during a postback. ie. if a datagrid is only displaying data
and
not being used for updates and such it can safely be disabled and will
decrease viewstate size.
In short go through your page by control and determine if each control is
being requested during your post backs if not disable viewstate

Arjen said:
Hi,

How do I keep the viewstate small?
I think I'm only using it for redirection
(String)ViewState["UrlReferrer"].

Thanks!
Arjen
 
Back
Top