Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 显示故障弹出对话框_Asp.net_Ajax_C# 4.0_Jquery - Fatal编程技术网

Asp.net 显示故障弹出对话框

Asp.net 显示故障弹出对话框,asp.net,ajax,c#-4.0,jquery,Asp.net,Ajax,C# 4.0,Jquery,在apsx页面中有一个div(弹出对话框),其中包含“错误,请检查您的登录凭据…”文本,通过调用下面的代码,将显示该div: $('#error-dialog').fadeIn('normal'); 所以有一个C#方法检查数据库表,并将登录结果返回为bool。我想在登录失败时显示弹出对话框。。。我的意思是我想在else语句中显示它。我怎么能做到 使用的标记:(还有一个脚本附加到页面…) 这就是我所做的——我并不是说这是最好的方式,但它对我来说很有效。使用您的按钮点击事件(假设它正在发回),您可

在apsx页面中有一个div(弹出对话框),其中包含“错误,请检查您的登录凭据…”文本,通过调用下面的代码,将显示该div:

$('#error-dialog').fadeIn('normal');
所以有一个C#方法检查数据库表,并将登录结果返回为bool。我想在登录失败时显示弹出对话框。。。我的意思是我想在else语句中显示它。我怎么能做到

使用的标记:(还有一个脚本附加到页面…)


这就是我所做的——我并不是说这是最好的方式,但它对我来说很有效。使用您的按钮点击事件(假设它正在发回),您可以添加以下内容。注意,这是VB,所以您必须转换为C

<div id="login-wrapper">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div id="error-dialog">
                <div id="icon">
                </div>
                <div id="messageText">
                </div>
                <a href="#" id="ok_button">

                 .....
protected void btnLogin_Click(object sender, EventArgs e)
{
    UserController ucontoller = new UserController();
    System.Threading.Thread.Sleep(1000);
    if (ucontoller.Check(txtUsername.Text, txtPassword.Text))
    {
        if (txtUsername.Text.Contains("admin"))
        {
            Response.Redirect("~/Administrator.aspx?uname=" + txtUsername.Text);
        }
        else
        {
            Response.Redirect("~/user.aspx?uname=" + txtUsername.Text);
        }

    }
    else
    {
        
        //display error popup....
        
    }
}
ScriptManager.RegisterStartupScript(Me.Page, GetType(String), "ShowError", "$('#error-dialog').fadeIn('normal');", True)