zoukankan      html  css  js  c++  java
  • 探Button控件的Click事件发生始末

    先贴结果图:

    点击后:

    页面代码:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    	<title></title>
    </head>
    <body>
    	<form id="form1" runat="server">
    	<div>
    		<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    		<hr />
    		<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
    	</div>
    	</form>
    </body>
    </html>
    

      

    public partial class _Default : System.Web.UI.Page
    {
    	Stopwatch watch = new Stopwatch();
    	public _Default()
    	{
    		watch.Start();
    	}
    	protected void Page_PreInit(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_PreInit<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_PreInit<br/>";
    	}
    	protected void Page_Init(object sender, EventArgs e)
    	{
    		//System.Threading.Thread.Sleep(1000);
    		Response.Write(watch.ElapsedTicks + ": Page_Init<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_Init<br/>";
    	}
    	protected void Page_InitComplete(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_InitComplete<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_InitComplete<br/>";
    	}
    	protected void Page_PreLoad(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_PreLoad<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_PreLoad<br/>";
    	}
    	protected void Page_Load(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_Load<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_Load<br/>";
    	}
    	protected void Page_LoadComplete(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_LoadComplete<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_LoadComplete<br/>";
    	}
    	protected void Page_PreRender(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_PreRender<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_PreRender<br/>";
    	}
    	protected void Page_PreRenderComplete(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_PreRenderComplete<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_PreRenderComplete<br/>";
    	}
    	protected void Page_SaveState(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_SaveState<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_SaveState<br/>";
    	}
    	protected void Page_SaveStateComplete(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_SaveStateComplete<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_SaveStateComplete<br/>";
    	}
    	protected void Page_Render(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Page_Render<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Page_Render<br/>";
    	}
    
    	protected void Button1_Click(object sender, EventArgs e)
    	{
    		Response.Write(watch.ElapsedTicks + ": Button1_Click<br/>");
    		Label1.Text += watch.ElapsedTicks + ": Button1_Click<br/>";
    	}
    }
    

    MSDN: ASP.NET 页生命周期概述

  • 相关阅读:
    分布式文件存储服务器之Minio对象存储技术参考指南
    httpClient4请求工具类实现
    xmake v2.5.9 发布,改进 C++20 模块,并支持 Nim, Keil MDK 和 Unity Build
    聊一聊Jmeter多用户token使用问题
    聊一聊Jmeter用IF控制器处理接口依赖
    SONiC架构分析
    SpringBoot
    微搭低代码能力月报:全新控制台/编辑器、集成企业微信、应用构建提速等
    微搭低代码已集成企业微信
    云开发CloudBase | 基本配置&用户邮箱登录开发
  • 原文地址:https://www.cnblogs.com/scotcn/p/2476588.html
Copyright © 2011-2022 走看看