C#中ISpostback

响应客户端控件时ispostback为true

代码:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;



public partial class DateShow : System.Web.UI.Page

{

    string date;

    protected void Page_Load(object sender, EventArgs e)

    {

        if (date == null)

        {

            date = DateTime.Now.ToString();

        }

        Response.Write("当前时间:"+ date);

        if (!IsPostBack)

        {

            Response.Write("第一次加载!");

        }

        else

        {

            Response.Write("响应客户端请求加载");

        }

    }

}

  刷新结果为第一次加载

     点击button结果为响应客户端请求加载。

你可能感兴趣的:(post)