在下面的代碼中,我一直在處理asp.net web應用程序。在我的情況下,textchange事件不會觸發。請幫助我解決問題。 代碼:TextChanged事件不在web應用程序中觸發
public delegate void LeavingFocusHandler(int CurrentIndex);
public event LeavingFocusHandler LeavingFocus;
public string strValue { get; set; }
public int ItemIndex { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
this.txtField.TextChanged += new EventHandler(txtField_Leave);
}
void txtField_Leave(object sender, EventArgs e)
{
try
{
this.strValue = txtField.Text;
if (this.LeavingFocus != null)
{
this.LeavingFocus(this.ItemIndex);
}
}
catch (Exception ex)
{
throw ex;
}
}
設計代碼:
<asp:TextBox ID="txtField" runat="server"></asp:TextBox>
的可能的複製[TextChanged事件功能無法正常工作(http://stackoverflow.com/questions/5029804/textchanged-event-function-not-working) – hellyale