Solved

Disabling ViewState

Posted on 2013-01-10
6
270 Views
Last Modified: 2013-01-17
I'm trying to disable ViewState - I've tried putting enableViewState="false" in web.config, in the page heading and in Page_Init and it still appears.

Not only does the page source contain it, but the controls continue to keep their old values. Text boxes retain their data, drop down lists retain the selected index after clicking a button that runs code on the server.

The only way I have found to genuinely stop this was to add Javascript to the page to remove __VIEWSTATE.

Is there a way to actually stop it working without the javascript?

I've attached my VS solution.
0
Comment
Question by:purplesoup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 20

Expert Comment

by:informaniac
ID: 38762536
What about the masterpage?
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 38762552
0
 

Author Comment

by:purplesoup
ID: 38762726
informaniac - exactly - what about it - the example doesn't have one.

pratima_mcs - I'm sure you didn't just send me a link to something that looked vaguely similar to my question without checking that it did actually solve my problem, so exactly which bit of that answer do you think I'm missing?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38762772
Did you intend to attach something?
0
 
LVL 20

Accepted Solution

by:
informaniac earned 500 total points
ID: 38763042
The textbox behavior is by design. It will retain it's value even if ViewState is disabled.(I just learned this today, when someone asked me this in an interview).

This link supports the behavior.
http://support.microsoft.com/?id=316813
0
 

Author Comment

by:purplesoup
ID: 38763661
ok I thought I'd attached my example and somehow it didn't attach... sorry :(

Well I want a simple example that shows ViewState not working so I can try alternatives to it - for example using ControlState.

Hopefully example now attached...
ControlStateExample.zip
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question