如何禁用隐藏ajax modalpopupextender?

时间:2014-06-11 07:50:45

标签: javascript jquery asp.net ajax popup

我在弹出扩展程序上使用我的网站登录格式。当我登录到网站并按下“登录”按钮时一切正常 - 当登录或密码不正确时,模式停留在页面上并且有关于错误数据的消息或什么时候都有。但是当我按下输入时弹出窗口正在隐藏(当数据不正确时,什么时候一切正常)。这是找到输入的代码:

var keyCode = event.keyCode || event.which; if (keyCode == 13) login();

这是我的登录metod:

var username = $get('txtUsername').value;
                var password = $get('pwdPassword').value;
                var isPersistent = $get('chkRememberMe').checked;
                var customInfo = null;
                var redirectUrl = null;

                Sys.Services.AuthenticationService.login(username,
                          password,
                          isPersistent,
                          customInfo,
                          redirectUrl,
                          onLoginComplete,
                          onLoginFailed
                         );

我不知道该怎么办。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

 <asp:Button ID="LoginModalBtn" runat="server" Style="display: none" />
<ajaxToolkit:ModalPopupExtender ID="LoginModalPopupExtender" TargetControlID="LoginModalBtn" runat="server" Enabled="true" PopupControlID="LoginModal" BackgroundCssClass="LoginPopup_Bacground" CancelControlID="MPE_backgroundElement" BehaviorID="MPE" Drag="false"></ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="LoginModal" runat="server" Width="386px" CssClass="LoginPopup">
    <asp:UpdatePanel ID="LoginModalUpdate" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel ID="loginPanel" runat="server" DefaultButton="LoginButton">
                <div id="AnonymousView" style="display: none;">
                    <div class="LoginMenuTop"></div>
                    <div class="LoginMenuMiddle">
                        <div style="display: table; padding-top: 30px;" id="loginFormat">
                            <asp:Label runat="server" ID="loginTextInfo" CssClass="LoginPlaceTitle">Zaloguj</asp:Label>
                            <div id="cookiesError" style="display: none; padding-left: 50px; padding-top: 10px;">
                                <span class="LoginFailureTextStyle" style="display: inherit;">* Logowanie nie było możliwe.</span>
                                <span class="LoginFailureTextStyle" style="display: inherit;">* Włącz obsługę cookie.</span>
                            </div>
                            <div class="LoginPlaceSeparatedLine" style="width: 80%; margin: auto;"></div>

                            <div class="LoginText" style="margin-top: 35px; margin-right: 17%;">
                                <div class="LoginTextLeft" id="usernameTextLeft"></div>
                                <div class="LoginTextMiddle" id="usernameTextMiddle">
                                    <span class="RegisterColumnLabels">E-mail: </span>
                                    <input id="txtUsername" type="text" class="LoginTextLabel" style="width: 180px;" onkeydown="LoginAfterEnterPress(event, this);" />
                                </div>
                                <div class="LoginTextRight" id="usernameTextRight"></div>
                            </div>

                            <div class="LoginText" style="margin-right: 17%; margin-top: 3px;">
                                <div class="LoginTextLeft" id="userPasswordLeft"></div>
                                <div class="LoginTextMiddle" id="userPasswordMiddle">
                                    <span class="RegisterColumnLabels">Hasło: </span>
                                    <input id="pwdPassword" type="password" class="LoginTextLabel" style="width: 180px;" onkeydown="LoginAfterEnterPress(event, this);" />
                                </div>
                                <div class="LoginTextRight" id="userPasswordRight"></div>
                            </div>

                            <div style="display: table; margin-top: 135px; margin-left: 30px;">
                                <input id="chkRememberMe" type="checkbox" style="display: none" />
                                <div class="RememberMeDIV" onclick="RememberMe();" id="rememberMe2" style="display: table-cell;"></div>
                                <div class="StayLogIn" style="width: 50%; display: table-cell; vertical-align: middle;">nie wylogowuj mnie</div>
                            </div>

                            <div style="display: table; float: right; margin-right: 65px;">
                                <div class="LoginButton" onclick=" return login();">
                                    <div class="LoginButtonLeft"></div>
                                    <div class="LoginButtonMiddle">
                                        <div class="LoginButtonLabel">Zaloguj się</div>
                                    </div>
                                    <div class="LoginButtonRight"></div>
                                </div>
                            </div>

这是我代码的一部分。