iam working on a web project which involves a inquiry form. can anyone help me in the view state mode of the text box, as i don't want that text box should retain values
Maintaining the ViewState is the default setting for ASP.NET Web Forms. If you want to NOT maintain the ViewState, include the directive <%@ Page EnableViewState="false" %> at the top of an .aspx page or add the attribute EnableViewState="false" to any control.
Here is the code: string strColor; if (Page.IsPostBack) { // Retrieve and display the property value. strColor = (string)ViewState["color"]; Response.Write(strColor); } else // Save the property value. ViewState["color"] = "yellow";
set the textbox and form to autocomplete="off" btw.. what is the best way to move the viewstate to the bottom of the page?
Hi, Try this code <script runat="server"> Sub submit(sender As Object, e As EventArgs) lbl1.Text="Hello " & txt1.Text & "!" End Sub </script> <html> <body> <form runat="server"> Your name: <asp:TextBox id="txt1" runat="server" /> <asp:Button OnClick="submit" Text="Submit" runat="server" /> <p><asp:Label id="lbl1" runat="server" /></p> </form> </body> </html> Thanks