Why do some asp.net controls retain their state, although its EnableViewState property is false?

Place the text box, check box, and button on the website. Set the EnableViewState property to a text box and false . Write something in the text box and check the box. Click the button.

Why is the text box still written and the check box selected after the response?

+3
source share
2 answers

Some things are not completely dependent on ViewState. In the controls you listed, these values ​​are available in the POST sent to the server, so they came out of there, and the controls restore their state in this way.

Other things, such as text in <asp:Label>, for example, are not sent back, and they lose their data without a ViewState. The same is true for other properties, such as the style of the text field, etc ... only it valuewill be restored, because it is all sent back and, as a result, everything that it is encoded for capture and recovery. If you say turn it red, it will be lost in the postback.

, , , , .

+8

HTML - . Microsoft ViewState, , , . "EnableViewState" "". ASP.NET EnableViewState True

-2

Source: https://habr.com/ru/post/1742446/


All Articles