2

我对 umbraco、母版页和所有这些内容相当陌生,但我正在赶上..

我似乎有这个奇怪的问题..我有一组母版页,内容包含 umbraco cms..

在母版页中,我有一个通用菜单和一个登录按钮。这个登录按钮会触发一个覆盖层,它包含在同一母版页内的一个 div 中。还有另一个覆盖在同一个母版页上创建一个新用户。问题是,登录覆盖中的按钮 OnClick 没有触发。有趣的是,我的文本框上的 required 属性确实触发了......你知道,弹出消息说你必须输入一些东西!但是我的自定义验证器什么都不做:S

这是我的母版页标题中的脚本:

<script runat="server">
    private void btnLogin_Click(object sender, EventArgs e)
    {
        Session["failedLogin"] = false;
        string mail = tbLoginMail.Text.Trim();
        string pass = tbLoginPass.Text;
        tbLoginMail.Text = "TEEEEEEST!";
        PageUtil.User = PageUtil.ValidateCredentials(mail, pass);
        if (PageUtil.User == null)
        {
            Session["failedLogin"] = true;
        }
        if (Page.IsValid)
            Server.Transfer(Page.ResolveClientUrl("/"));
    }

    private void UserLoginResponse(object source, ServerValidateEventArgs args)
    {
        if (Session["failedLogin"] != null)
        {
            if ((bool)Session["failedLogin"])
            {
                args.IsValid = false;
            }
        }
    }
</script>

甚至文本框中的文本都没有设置为 teeesst!Any1有什么建议吗?

这是包含 2 个 div 的主体:

<body>
<a name="LoginLink" href="#overlay" class="submitbtn"><%= PageUtil.IsLoggedIn() ? "Log ud" : "Log Ind" %></a>
<form runat="server">
    <div id="overlay">
        <div id="popup">
            <!-- ANY CONTENTS -->
            <a href="">
                <img class="close_button" src="/media/Images/close.png" /></a>
            <div id="login" class="login">
                <asp:CustomValidator ID="CustomValidator1" runat="server" ValidationGroup="login" ErrorMessage="Forkert e-mail eller password" OnServerValidate="UserLoginResponse" Display="Dynamic"></asp:CustomValidator><br />
                <label>E-mail</label>

                <asp:TextBox ID="tbLoginMail" type="text" TabIndex="1" class="input" ValidationGroup="login" placeholder="email eller brugernavn" required="true" runat="server" /><br>
                <br>

                <label>Password</label>

                <asp:TextBox ID="tbLoginPass" type="password" class="input" TabIndex="2" required="true" ValidationGroup="login" runat="server" /><br>
                <br>

                <asp:CheckBox ID="cbRememberMe" type="checkbox" TabIndex="3" runat="server" />Keep me logged in

                   <asp:Button ID="submitbtn" Text="Login" TabIndex="4" OnClick="btnLogin_Click" runat="server" ValidationGroup="login" CausesValidation="true" /><br />
                Ikke oprettet? <a href="#overlay_signup">Opret bruger!</a>
            </div>
        </div>
    </div>
    <div id="overlay_signup">
        <div class="overlay popup" style="height: 500px;">
            <a href="#">
                <img class="close_button" src="/media/Images/close.png" /></a>
            <div class="login">
                <label>Navn</label>

                <asp:TextBox ID="createUserName" type="text" TabIndex="1" ValidationGroup="signUp" class="input" placeholder="Navn" required="true" runat="server" /><br>
                <br>

                <label>Email</label>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp

                  <asp:TextBox ID="createUserMail" type="text" class="input" ValidationGroup="signUp" placeholder="e-mail" TabIndex="2" required="true" runat="server" /><br>
                <br>

                <label>Password</label>

                <asp:TextBox ID="tbCreateUserPass" type="password" ValidationGroup="signUp" class="input" TabIndex="2" required="true" runat="server" /><br>
                <br>

                <asp:Button runat="server" ID="submit1" class="submitbtn" ValidationGroup="signUp" Text="SignUp" TabIndex="4" />
            </div>
        </div>
    </div>

    <div id="box">
        <div id="head">
            <umbraco:Macro ID="Macro1" Alias="MenuBar" runat="server"></umbraco:Macro>
        </div>
        <div class="header">
            <umbraco:Item ID="Item2" Field="header" runat="server" />
        </div>
        <div id="content">
            <umbraco:Item ID="Item1" Field="bodyText" runat="server" />
            <div id="contentDiv">
                <asp:ContentPlaceHolder ID="pageContent" runat="server" />
            </div>
        </div>
        <div class="dotSeperator">...</div>
        <div id="footer">
            <p class="footerText">| Martin Stendorf Jensen | Copyright ® 2013 | <a href="mailto:mstendorf@outlook.com?Subject=Henvendelse%20fra%20website">mstendorf@outlook.com</a> | +4527126901 |</p>
        </div>
    </div>
</form>

4

0 回答 0