473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How to keep viewstate small?

Hi,

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

Thanks!
Arjen
Aug 22 '06 #1
3 1236
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" wrote:
Hi,

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

Thanks!
Arjen
Aug 23 '06 #2
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" <we**@discussions.microsoft.comschreef in bericht
news:88**********************************@microsof t.com...
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" wrote:
>Hi,

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

Thanks!
Arjen

Aug 23 '06 #3
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" <bo*****@hotmail.comwrote in message
news:ec**********@news3.zwoll1.ov.home.nl...
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" <we**@discussions.microsoft.comschreef in bericht
news:88**********************************@microsof t.com...
>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" wrote:
>>Hi,

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

Thanks!
Arjen


Aug 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul | last post by:
Hello, First I want to refer to the problem "WebRequest : execute a button" of a few days ago. The way I solved it, I loose my session, and as a consequence my session variables. I don't want...
3
by: Trevor Andrew | last post by:
Hi There, I have a small ASP.NET application under development. I am using VS.NET 2002 (2003 upgrade is on the way) with .NET Framework 1.1. It is hosted on a web hosting service in the US. I am...
3
by: Lloyd Sheen | last post by:
I have a page that works fine. I am trying to optimize the page by overriding some of the Information that is being saved in the hidden VIEWSTATE. If I make the properties of the dropdown False...
2
by: Fred Newton | last post by:
Just wondering if there are any strong arguments one way or the other for storing a small value (6 bytes) in the ViewState vs. Session state. The value is needed in only one page in a large ASP.NET...
2
by: Janaka | last post by:
We have managed to lock down 99% of the application errors occurring in our asp.net sites. The only errors which occur on a regular basis now are viewstate errors. We have disabled viewstate on...
4
by: rom | last post by:
I saw a "strange" code line somewhere on the web. it looks like: ViewState(myKeyWord) = myValue what am I missing here? what exactly is the viewstate ?is it different from session?
2
by: Ryan Ternier | last post by:
I'm playing around with Cache and Viewstate. I've made a small little example that reminds me of grade 12: if(!IsPostBack) { ArrayList alTest = new ArrayList(); alTest.Add("This is from...
12
by: Nick C | last post by:
Hi How can i reduce the viewstate for my asp.net application. It is getting very large now. What is a good solution? thanks N
0
by: Scott Roberts | last post by:
I always thought that the viewstate "keys" included the control ID. As long as the control IDs were unique, there shouldn't be any conflicts. Well, it appears that that may not be the case with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.