我在更新面板中使用文本框,并且textchanged
此文本框有事件。textchanged
事件是第一次触发并显示一个电子邮件 ID 存在的警报框。当我在文本框中提供电子邮件 ID 时。但是在再次单击警报框中的确定按钮后,我在文本框中给出了电子邮件 ID,这次 textchanged 事件没有触发。
HTML
<dt>Email:<span style="color: #FF0000;">*</span></dt>
<dd>
<**asp:UpdatePanel ID="UpdatePanel8" runat="server">
<ContentTemplate>
<cc1:OboutTextBox ID="txtEmail" class="input" runat="server"
ontextchanged="txtEmail_TextChanged" AutoPostBack="true"></cc1:OboutTextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtEmail" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>**
</dd>
</dl>
代码背后:
protected void txtEmail_TextChanged(object sender, EventArgs e)
{
bool flag = false;
if (txtEmail.Text.Trim() != "")
{
string _GlobalDB = Server.MapPath("~//DB//Global.accdb");
flag = Utility.isEmailExist(txtEmail.Text.Trim(), _GlobalDB);
}
if (flag)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "MyScript", @"javascript:alert('Email ID Exist ,Please Use another Email ID.')", true);
txtEmail.Text = "";
txtEmail.Focus();
}
}