Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Disabling ViewState

Posted on 2013-01-10
6
Medium Priority
?
283 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
Independent Software Vendors: 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 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

618 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