[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

Disabling ViewState

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
purplesoup
Asked:
purplesoup
1 Solution
 
informaniacCommented:
What about the masterpage?
0
 
Pratima PharandeCommented:
0
 
purplesoupAuthor Commented:
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
käµfm³d 👽Commented:
Did you intend to attach something?
0
 
informaniacCommented:
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
 
purplesoupAuthor Commented:
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now