protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("你按按鈕");
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
Response.Write( "感謝輸入資料");
//textBox1的AutoPostBack為true
}
如果TextBox1輸入文字後,第一個按下的是Button1
為何不觸發Button1_Click事件?
我放影片在這邊
https://www.youtube.com/watch?v=SfxVcH69vwA
textbox1失去焦點後會觸發TextChanged事件,然後就postback了,button事件會被吃掉
參考:https://support.microsoft.com/zh-tw/help/810203/control-focus-on-an-asp-net-web-server-control-is-lost-after-autopostb
WebForm ?
應該是事件的對應方法跑掉了
https://www.youtube.com/watch?v=SfxVcH69vwA
影片如上 ,不好意思麻煩各位!