ASP.Net/Page/Page Unload

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Using the UnLoad Event of the Page Object

   <source lang="csharp">

<%@ Page Language=VB Debug=true %> <%@ Import Namespace="System.Web.Mail" %> <script runat=server> Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

   lblFixed.Text = "Welcome to the page!"
   lblStatic.Text = "The current time on the server is " _
       & TimeOfDay()
   lblDone.Text = Session("FinalText")

End Sub Sub Page_Unload(ByVal Sender as Object, ByVal E as EventArgs)

   Session("FinalText")  = "During last load, the " _
       & "page finished processing at: " & TimeOfDay()

End Sub </script> <HTML> <HEAD> <TITLE>Using the UnLoad Event of the Page Object</TITLE> </HEAD> <Body LEFTMARGIN="40"> <form runat="server"> <asp:label

   id="lblFixed" 
   runat="server"

/>

<asp:label

   id="lblStatic" 
   runat="server"

/>

<asp:label

   id="lblDone" 
   runat="server"

/> </Form> </BODY> </HTML>

      </source>