Click here to Skip to main content
16,018,419 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
i disable view state to my text box control using enableviewstate=false
but still textbox retaining its value after post back.how to completely disable viewstate
Posted

1 solution

Quote:
Why some controls retain values even after disabling the ViewState while others do not?

The answer is Controls which implements IPostBackEventHandler like Textbox, Checkbox, etc. will retain the state even after disabling the viewstate. The reason is during the Load Postback Data stage, these controls will get state information from Posted back form.

But controls like label which do not implement IPostBackEventHandler will not get any state information from posted back data and hence depend entirely on viewstate to maintain the state.

ViewState and Postback[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900