Refresh (1 Viewer)

accessman2

Registered User.
Local time
Yesterday, 18:28
Joined
Sep 15, 2005
Messages
335
<script runat="server">
Sub Page_Load
if Not Page.IsPostBack then
lbl1.Text="The date and time is " & now()
end if
End Sub
Sub Submit(s As Object, e As EventArgs)
lbl2.Text="Hello World!"
End Sub
</script><html>
<body>
<form runat="server">
<h3><asp:label id="lbl1" runat="server" /></h3>
<h3><asp:label id="lbl2" runat="server" /></h3>
<asp:button text="Submit" onclick="submit" runat="server" />
</form>
</body>
</html>

When I run these codes, it works, I click submit button, it shows the "Hello World!", and then I click refresh button on the menu bar of IE, it still show "Hello World!", how can I reset it, remove "Hello World!"?
 

Kodo

"The Shoe"
Local time
Yesterday, 21:28
Joined
Jan 20, 2004
Messages
707
This is because the value of the label is being held in viewstate. if you want to eliminate that, then set enbaleviewstate to false for the label.
 

Users who are viewing this thread

Top Bottom