473,666 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Huge viewstate on v2.0

I'm having problems controlling viewstate size in ASP.NET 2.0.

I have a repeater, which contains a gridview, which contains another
gridview. All this is databound to produce a 100page report (for printing).
No postback needed, no viewstate needed.

I've set EnableViewState ="false" on everything I can see, including all the
controls, the form and the page itself. But the viewstate is still 10 lines
in notepad (without wrapping!). I assume this is the elusive ControlState
that I can't turn off?

I tried removing the form tag, but that broke the gridviews (they need form
runat="server") .

Any ideas? I can serialize the viewstate to session / db, but frankly that's
stupid in this situation - I just don't need ANY viewstate.

Thanks,

John

PS. I suppose I could bodge a PageWithNoViewS tate class, with a empty
SavePageStateTo PersistenceMedi um() method. But do I really have to do that??
Dec 2 '05 #1
1 1398
I wrote the following Page desendent, any better solutions would be
appretiated!

public class NoVSPage : Page
{
protected bool noviewstate = true;

protected override object LoadPageStateFr omPersistenceMe dium()
{
if (noviewstate)
throw new Exception("This page does not support postback");
else
return base.LoadPageSt ateFromPersiste nceMedium();
}

protected override void SavePageStateTo PersistenceMedi um(object viewState)
{
if (noviewstate)
return;
else
base.SavePageSt ateToPersistenc eMedium(viewSta te);
}
}


"John" <js************ @ecclesdeleteth iscollege.ac.uk > wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .
I'm having problems controlling viewstate size in ASP.NET 2.0.

I have a repeater, which contains a gridview, which contains another
gridview. All this is databound to produce a 100page report (for
printing). No postback needed, no viewstate needed.

I've set EnableViewState ="false" on everything I can see, including all
the controls, the form and the page itself. But the viewstate is still 10
lines in notepad (without wrapping!). I assume this is the elusive
ControlState that I can't turn off?

I tried removing the form tag, but that broke the gridviews (they need
form runat="server") .

Any ideas? I can serialize the viewstate to session / db, but frankly
that's stupid in this situation - I just don't need ANY viewstate.

Thanks,

John

PS. I suppose I could bodge a PageWithNoViewS tate class, with a empty
SavePageStateTo PersistenceMedi um() method. But do I really have to do
that??

Dec 3 '05 #2

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

Similar topics

9
21639
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter the results in the grid. Say you filter the grid for records that have a certain condition set to "NO" (in this case a checkbox). In this scenario the search returns one result. If I then check the checkbox ("YES") and save it, I now get my message...
3
2639
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event and this causes control B to be created, when this is done the VIEWSTATE is lost for CONTROL B. In the EVENT that causes CONTROL B to be created I have to set
10
2260
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and disable the session state in Web.Config the VIEWSTATE variable is still maintained and stores some values. Can anyone tell what those values are for, i.e what other info is stored in VIEWSTATE other than the session ID and the control values ?
7
2039
by: et | last post by:
I'm not sure I understand the use of the ViewState. Do I understand correctly that values of controls are automatically held in a hidden control called ViewState? If so, then why can't we get them, or how do we get that value? I always have to set the ViewState("FirstName") = txtBox.text myself before a postback is done, otherwise, the value of ViewState("FirstName") is always empty; there doesn't seem to be a way to retrieve that...
3
1432
by: Lars Grøtteland | last post by:
Hello! My ViewState is huge. I have a couple two comboboxes, three edit boxes with one button each, and a dataGrid. I'm showing 200 items in the grid, and when the page loads, the viewState is 61 pages pasted into Word. - That's over 3/4 of the aspx page. Any help how to size down this ViewState would be appreciated. - Lars
7
1539
by: Mantorok | last post by:
It's not unusual (to be lo....cough) for me to have VIEWSTATE ranging from 1 full page to several pages..... This seems in-efficient - any ideas how to reduce the thing? Thanks Kev
6
2058
by: hitendra15 | last post by:
Hi I have created web user control which has Repeater control and Linkbutton in ItemTemplate of repeater control, following is the code for this control On first load it runs fine but when page gets post back it gives following error Failed to load viewstate. The control tree into which viewstate is
3
3480
by: Gummy | last post by:
Hello, I have an ASPX page on which I place a UserControl 15 times (they only need to be static controls on the page). This UserControl is a set of two listboxes with radiobuttons above the listbox (to select between viewing a code or description in the listbox). There are also left and right arrows that move the selected items between the listboxes. In my Page_Load I assign each UserControl the appropriate DataTable and this...
12
1915
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
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8779
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.