在asp.net服务器控件中响应客户端与服务器端事件的例子

四个按钮的例子说明了 响应客户端与服务器端事件的先后顺序.

ketu.aspx代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="kehu.aspx.cs" Inherits="kehu" %>




    在asp.net服务器控件中响应客户端与服务器端事件的例子


   


   

       

         

       

       

       

       

   



kehu.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 kehu : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


        Label1.Text = DateTime.Now.ToString();

        Button1.Attributes.Add("onclick", "sayhello()");
   
    }

 

 

    protected void Submit2_ServerClick(object sender, EventArgs e)
    {
        Submit2.Value = DateTime.Now.ToString();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Button1.Text = DateTime.Now.ToString();
    }
    protected void Button2_ServerClick(object sender, EventArgs e)
    {
        Button2.Value = DateTime.Now.ToString();
    }
}

 

 

你可能感兴趣的:(服务器,asp.net,button,server,object,input)