[英]How to show a error when a modal popup extender is active
create user: 创建用户:
if (emailcount != 0)
{
Page.ClientScript.RegisterStartupScript(GetType(), "UserDialogScript",
"alert(\"User already exists!\");", true);
}
I check whether the email is already used, if it is used I want to pop up the error but the page stays still with the modalpopupextender on the top. 我检查电子邮件是否已被使用,如果已使用,我想弹出错误,但页面仍然停留在顶部,与modalpopupextender相同。 I am not able to do anything after that,.
之后,我无能为力。 How can I display the error.
如何显示错误。
I would use a different approach for this. 我将为此使用其他方法。 In your modal popup extender, try something like this:
在模式弹出扩展器中,尝试执行以下操作:
<asp:UpdatePanel ID="pnlUserDetails" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtEmail" runat="server" OnTextChanged="txtEmail_OnTextChanged" AutoPostBack="true"></asp:TextBox>
<asp:Label ID="lblEmailMessage" runat="server" Text="Already exists!" Visible="false" />
</ContentTemplate>
</asp:UpdatePanel>
In the code-behind: 在后面的代码中:
protected void txtEmail_TextChanged(object sender, EventArgs e)
{
//check for matching email address and show label if match is found
lblEmailMessage.Visible = FindMatchingEmailAddress(txtEmail.Text.Trim());
//clear the email input if a match is found??
txtEmail.Text = String.Empty;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.