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

enable viewstate after disabling

I would like 95% of my site to have the viewstate disabled, in order to
reduce the size of my pages. However, there are about 5% of the pages
on my site that will require viewstate.

Is there any way to make it so that pages have viewstate disabled by
default, but override it to enabled on a page-by-page basis? As of
now, it looks like when i disable the viewstate in my web.config, I
can't re-enable it for the couple pages that need viewstate.

In fact, ideally, I would have viewstate disabled for 99% of the
controls on my pages, and just enable it for a couple controls. It's
such a pain to have to leave it enabled by default and turn it off on a
control by control basis.

I am using ASP.Net 2.0.

Nov 23 '05 #1
3 1423
<pages enableViewState="false"> in web.config, then for those you want to
enable ViewState make sure you have <%@ Page EnableViewState="true" ... %>

-Brock
DevelopMentor
http://staff.develop.com/ballen
I would like 95% of my site to have the viewstate disabled, in order
to reduce the size of my pages. However, there are about 5% of the
pages on my site that will require viewstate.

Is there any way to make it so that pages have viewstate disabled by
default, but override it to enabled on a page-by-page basis? As of
now, it looks like when i disable the viewstate in my web.config, I
can't re-enable it for the couple pages that need viewstate.

In fact, ideally, I would have viewstate disabled for 99% of the
controls on my pages, and just enable it for a couple controls. It's
such a pain to have to leave it enabled by default and turn it off on
a control by control basis.

I am using ASP.Net 2.0.

Nov 23 '05 #2
That's actually what I tried, first. For some reason, whenever I set
<pages enableViewState="false"> in web.config, it is ignoring the Page
directive: <%@ Page EnableViewState="true" %>

Is this by design, or is there something wrong with my site?

Nov 29 '05 #3
By design.

If you set <pages enableViewState="false"> in web.config,
no page directive will work, since EnableViewState was
"turned off" in the application's config file.

OTOH, if you set <pages enableViewState="true"> in web.config,
( which you don't really need to do, since that's the default setting )
then you can turn it *off* in individual pages.

Juan T. Llibre
ASP.NET.FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================

<sw*******@gmail.com> wrote in message news:11**********************@g44g2000cwa.googlegr oups.com...
That's actually what I tried, first. For some reason, whenever I set
<pages enableViewState="false"> in web.config, it is ignoring the Page
directive: <%@ Page EnableViewState="true" %> Is this by design, or is there something wrong with my site?

Nov 29 '05 #4

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

Similar topics

6
by: Robin Bonin | last post by:
In my user contol I am creating a set of dropdownlists. Each list is created based on input from the other lists. The problem I am having is setting the selected index on the lists. If someone...
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...
6
by: sonic | last post by:
Hi, I am experimenting with different viewstate management ideas for large datagrids, and found a microsoft suggestion to turn it off, and only store relevant information by manually accessing...
6
by: John | last post by:
Hi all, I am using dynamic user controls within my web app and these controls are loaded into placeholders via the LoadControl method. My problem is this: I have usercontrolA loaded into a...
4
by: Sven Jacobs | last post by:
Hello everybody! Imagine a form with several TextBox WebControls and two buttons "New" which should clear the form and "Save". On reloading or leaving the page which holds the form the TextBoxes...
1
by: Petr SIMUNEK | last post by:
I have 3 buttons on the page. (Created dynamicaly inside For- next loop and hooked up to click event.) When different button is clicked i would like to save a different value to viewstate. In the...
7
by: GS | last post by:
Hello, I'm receiving The state information is invalid for this page and might be corrupted error message when running code below. This happens on second post back. Why is it happening? My...
3
by: Justin | last post by:
I have aspx pages with 10 checkboxlist controls. total individual checkbox (the sum of individual checbox in those 10 checkboxlists) on the page is about 1710. You can imagine how large the...
4
by: =?Utf-8?B?TUNN?= | last post by:
I am trying to disable ViewState at the application level. I have the following line in my web.config: <pages enableViewState="false"></pages> But it is not working. What can I do?
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.