<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="PageFlow" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Page Flow</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label id="lblInfo" runat="server" EnableViewState="False">
</asp:Label>
<asp:Button id="Button1" runat="server"
Text="Button" OnClick="Button1_Click"></asp:Button>
</div>
</form>
</body>
</html>
File: Default.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class PageFlow : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
lblInfo.Text += "Page.Load event handled.<br/>";
if (Page.IsPostBack)
{
lblInfo.Text += "<b>second time</b><br/>";
}
}
private void Page_Init(object sender, System.EventArgs e)
{
lblInfo.Text += "Page.Init event handled.<br/>";
}
protected void Button1_Click(object sender, System.EventArgs e)
{
lblInfo.Text += "Button1.Click event handled.<br/>";
}
private void Page_PreRender(object sender, System.EventArgs e)
{
lblInfo.Text += "Page.PreRender event handled.<br/>";
}
private void Page_Unload(object sender, System.EventArgs e)
{
lblInfo.Text += "Page.Unload event handled.<br/>";
}
}