How does setting EnableViewstate to false really function ?
Posted on 2003-10-28
I have created a simple web application using Visual Studio.NET as follows :
<%@ Page Language="VB" EnableViewstate="false" %>
Enter Your Name : <asp:textbox Id = "tbxMessage" Runat="server"/>
<asp:button Id="btnSubmit" Text="Submit" Runat="server"/>
I believe after submitting the page with some text in the text box the page should be re-displayed with the textbox being empty in the manner that a traditional asp page works, since I've set the EnableViewstate attribute to "false".
However, when I've found after submitting the page, that it re-displays the text that was input into the text box after it returns.
When I checked the source of the returned page, it did display a ViewState hidden element in it.
I was trying to understand how exactly "viewstate" works by creating a simple page. Is my understanding of the viewstate as mentioned in the para immediately above incorrect ? What am I missing. Kindly guide me.