?
Solved

Disabling ViewState

Posted on 2013-01-10
6
Medium Priority
?
277 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 75

Expert Comment

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

Accepted Solution

by:
informaniac earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

770 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