enableviewstate=true allows you to add things to the viewstate.Make a form with 2 buttons and a text box.Take a look at the following code. Run it with enableviewstate=true and then enableviewstate=false. You will see the difference.The first button adds the value of the Textbox to the ViewState. The second reads and wrties it from the ViewSate. When ViewState is set to false the second button will not write the value.ASP Page <form id="Form1" method="post" runat="server"><P><asp:TextBox id="TextBox1" runat="server"></asp:TextBox></P><P><asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P><P> </P><P><asp:Button id="Button2" runat="server" Text="Button"></asp:Button></P> </form>
Code Behind Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ViewState("Text") = TextBox1.Text End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Response.Write(ViewState("Text")) End Sub
JBelthoffDodge, Duck, Dip, Dive & DodgeIf a man can dodge a wrench, he can dodge a ball!
Asp Hoting Provider