473,395 Members | 1,442 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,395 software developers and data experts.

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 PageWithNoViewState class, with a empty
SavePageStateToPersistenceMedium() method. But do I really have to do that??
Dec 2 '05 #1
1 1387
I wrote the following Page desendent, any better solutions would be
appretiated!

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

protected override object LoadPageStateFromPersistenceMedium()
{
if (noviewstate)
throw new Exception("This page does not support postback");
else
return base.LoadPageStateFromPersistenceMedium();
}

protected override void SavePageStateToPersistenceMedium(object viewState)
{
if (noviewstate)
return;
else
base.SavePageStateToPersistenceMedium(viewState);
}
}


"John" <js************@ecclesdeletethiscollege.ac.uk> wrote in message
news:%2***************@TK2MSFTNGP11.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 PageWithNoViewState class, with a empty
SavePageStateToPersistenceMedium() 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
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...
3
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...
10
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...
7
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...
3
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...
7
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
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...
3
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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...

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.