IsPostBack 用法

  • 1406
  • 0

摘要:IsPostBack 用法

 

        protected void Page_Load(object sender, EventArgs e)
        {
            string UserID;
            UserID = Request["UserID"];
            Label1.Text = UserID;
            userReVise = JsonConvert.DeserializeObject<WebUser>(File.ReadAllText(@"D:\test\" + UserID));
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////當按下BUTTON後網頁會再重整就會重新LOAD_PAGE  因此需設一個  ISPOSBACK   來擋住他復蓋~!
            if (!IsPostBack)
            {
                TextBox1.Text = userReVise.PW;
                TextBox2.Text = userReVise.Name;
                TextBox3.Text = userReVise.Age;
            }
        }
///////////////////////////////////////////////////////////////////////////