jQuery的登录对话框按钮 [英] jQuery Login Dialog Buttons

查看:107
本文介绍了jQuery的登录对话框按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个弹出包含我的日志形式的对话框中的链接。
该对话框弹出,我可以看到我日志中的形式,但按键和验证器不工作。

I have a link that pops up a dialog box containing my log in form. The dialog pops up and I can see my log in form but the buttons and validators don't work.

任何想法?

我的code:

<a href="#" rel="dialog_content" class="simpledialog">show dialog!</a>
    <!-- content -->
    <div id="dialog_content" style="display: none;">
        <h1>
            Login
        </h1>
        <asp:Label runat="server" ID="MsgBox" ForeColor="Red" Font-Size="18"></asp:Label>
        <div>
            User Name :</div>
        <div>
            <asp:TextBox ID="Username" Text="Or" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="UsernameValidator" runat="server" ErrorMessage="Fill User Name"
                ControlToValidate="Username">*</asp:RequiredFieldValidator>
            <asp:CustomValidator ID="LoginMatchU" ControlToValidate="Username" runat="server"
                ErrorMessage="Incorrect Password Or User Name" OnServerValidate="LoginMatch_ServerValidate">*</asp:CustomValidator></div>
        <br />
        <div>
            Password :
        </div>
        <div>
            <asp:TextBox ID="Password" TextMode="Password" Text="123" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="PasswordValidator" runat="server" ErrorMessage="Fill Password"
                ControlToValidate="Password">*</asp:RequiredFieldValidator>
            <asp:CustomValidator ID="LoginMatchP" ControlToValidate="Username" runat="server"
                OnServerValidate="LoginMatch_ServerValidate">*</asp:CustomValidator></div>
        <br />
        <div>
            <asp:Button ID="LoginBtn" Text="Login" runat="server" OnClick="LoginBtn_Click" />
        </div>
        <asp:ValidationSummary ID="ValidationSummary" runat="server" />
    </div>

插件

<script src="../jQuery.js" type="text/javascript"></script>
<link href="jquery.simpledialog.css" type="text/css" rel="stylesheet" /><script type="text/javascript">
    $(document).ready(function () {
        $('.simpledialog').simpleDialog();
    });</script>

本的.cs

protected void LoginMatch_ServerValidate(object source, ServerValidateEventArgs args)
{
    args.IsValid = Users.Exist(Username.Text, Password.Text);
}
protected void LoginBtn_Click(object sender, EventArgs e)
{
    if (Page.IsValid)
    {
        string username = Username.Text;
        Session["Username"] = username;
        string redirect = @"~/User/UserQueries.aspx";
        if (Admin.IsAdmin(username) == "True")
        {
            Session["IsAdmin"] = "True";
            redirect = @"~/User/UserQueries.aspx";
        }
        Response.Redirect(redirect);
    }
}

BTW链接到该对话框位于我的母版,所以是所有code我写了^

BTW Link to the dialog box is located at my MasterPage and so is all the code I wrote ^

推荐答案

我认为你需要将你的对话框到表单中则只有按钮应工作。请尝试以下操作:

I think you need to place your dialog box into the form then only the buttons shall work. Try the following:

var dialog = $('.simpledialog').simpleDialog();
dialog.parent().appendTo(jQuery('form:first'));

这篇关于jQuery的登录对话框按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆