ASP.Net/Page/Page Init
Page Event: init (C#)
<source lang="csharp">
<%@ Page Language="C#" Debug="true"%> <script runat="server">
void Page_Init() { Trace.Write("NOTE - First line of Page_Init"); }
</script> <html> <head>
<title>Demonstration of Page Events</title>
</head> <body>
<form runat="server"> <asp:Button id="Button1" runat="server" Text="Submit"></asp:Button>
</form>
</body> </html>
</source>
Page init and load event (VB.net)
<source lang="csharp">
<script language="vb" runat="server"> Dim intGlobal As Integer = 0 Sub Page_Init()
intGlobal=intGlobal+1 Message1.Text += "
Page_Init has called this line at " & Now() & _ " with the value of intGlobal being :" & intGlobal
End Sub Sub Page_Load()
intGlobal=intGlobal+1 Message2.Text += "
Page_Load has called this line at " & Now() & _ " with the value of intGlobal being :" & intGlobal
End Sub </script> <html> <head>
<title>Automatic Events Example</title>
</head> <body> <form runat="server">
<input type="submit" value="Click to continue">
<asp:label id="message1" runat="server"/> <asp:label id="message2" runat="server"/>
</form> </body> </html>
</source>