登录控件在updatepanel中无法正常工作 [英] Login control not working inside updatepanel

查看:81
本文介绍了登录控件在updatepanel中无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在主页上放置了一个Loginstatus控件,并使用Add Extender添加了ModalPopupExtender。在此ModalPopup中放置了一个Login控件。将此Login控件转换为模板。



如果给出了正确的ID / Pass,登录控制正在运行。但是应该显示FailureText的文字控件没有显示在updatepanel中没有闪烁的行为。



我尝试了什么:



如果我使用asp:postbacktrigger它回发整页并再次单击Loginstatus显示ModalPopup和FailureText。



如果我使用asp:AnsyncPostBackTrigger,则不会显示回发行为。



I placed a Loginstatus control on masterpage and using Add Extender, added ModalPopupExtender. Placed a Login control inside this ModalPopup. Turned this Login control to template.

The login control is working if correct ID/Pass is given. But the literal control that is supposed to show FailureText is not showing in updatepanel's no flicker behaviour.

What I have tried:

If I use asp:postbacktrigger it postback full page and again clicking Loginstatus shows the ModalPopup and the FailureText.

If I use asp:AnsyncPostBackTrigger, no postback behavior is shown.

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Frontend.master.cs" Inherits="sitetitle.MasterPages.mastername" %>

<%@ Register Src="~/Controls/LoginControl.ascx" TagPrefix="uc1" TagName="LoginControl" %>
<%@ Register Src="~/Management/ManagementControls/LoginModalControl.ascx" TagPrefix="uc1" TagName="LoginModalControl" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>

<%//@ Register Src="~/Controls/topLoginUserStrip.ascx" TagPrefix="uc1" TagName="topLoginUserStrip" %>




<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head  runat="server">
    <title>site title</title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    
    <link href="../Styles/styles.css" rel="stylesheet" />
    <script src="../Scripts/modernizr-2.8.3.js"></script>
    
    <link href="../Styles/button.css" rel="stylesheet" />    
    <link href="../Styles/dd.css" rel="stylesheet" />
    <link href="../Styles/dialog.css" rel="stylesheet" />    
    <link href="../Styles/jquery-ui.css" rel="stylesheet" />        
    
    <script src="../Scripts/jquery-2.2.1.js"></script>    
    <script src="../Scripts/jquery-ui-1.11.4.js"></script>    
    <script src="../Scripts/jquery-ui.js"></script>    
    <script src="../Scripts/modernizr-2.8.3.js"></script>

</head>
<body id="body">

    <form id="form1"  runat="server">

        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true" AsyncPostBackTimeout="10000">
            <Scripts>
                <asp:ScriptReference Path="~/Scripts/jquery-2.1.4.min.js" />
            </Scripts>
                    

    <div>
            <asp:UpdatePanel ID="updPanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
            <contenttemplate>
                <asp:Panel runat="server" ID="Pan1" style="display:none;" CssClass="modalPopup" >
                    <asp:UpdatePanel runat="server">
                        <contenttemplate>
                <asp:Login ID="Login1" runat="server" CreateUserText="SignUp" CreateUserUrl="~/Signup.aspx" FailureText="Wrong ID/Password" OnLoggingIn="Login1_LoggingIn" OnLoginError="Login1_LoginError">
                    <layouttemplate>
                        <table cellspacing="0" cellpadding="1" style="border-collapse: collapse;">
                            <tr>
                                <td>
                                    <table cellpadding="0">
                                        <tr>
                                            <td align="center" colspan="2">Log In</td>
                                        </tr>
                                        <tr>
                                            <td align="right">
                                                <asp:Label runat="server" AssociatedControlID="UserName" ID="UserNameLabel">User Name:</td>
                                            <td>
                                                <asp:TextBox runat="server" ID="UserName">
                                                <asp:RequiredFieldValidator runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ValidationGroup="ctl00$Login1" ToolTip="User Name is required." ID="UserNameRequired">*
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right">
                                                <asp:Label runat="server" AssociatedControlID="Password" ID="PasswordLabel">Password:</td>
                                            <td>
                                                <asp:TextBox runat="server" TextMode="Password" ID="Password">
                                                <asp:RequiredFieldValidator runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ValidationGroup="ctl00$Login1" ToolTip="Password is required." ID="PasswordRequired">*
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <asp:CheckBox runat="server" Text="Remember me next time." ID="RememberMe">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="center" colspan="2" style="color: Red;">
                                                <asp:Label ID="lblTrial" runat="server" />
                                                <asp:Literal runat="server" ID="FailureText" EnableViewState="False" >
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="right" colspan="2">
                                                
                                                <asp:Button runat="server" CommandName="Login" Text="Log In" ValidationGroup="ctl00$Login1" ID="LoginButton" OnClick="LoginButton_Click">
                                                
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                Not a member yet? <asp:HyperLink runat="server" NavigateUrl="~/Signup.aspx" ID="CreateUserLink">SignUp
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </layouttemplate>
                
                            </contenttemplate>
                        <triggers>
                                                        <asp:AsyncPostBackTrigger ControlID="Login1" />
                                                    </triggers>  
                    
                            
                </contenttemplate>    
        
    
        

        <asp:LoginStatus ID="LoginStatus1" runat="server" />
        
        <ajaxToolkit:ModalPopupExtender ID="LoginStatus1_ModalPopupExtender"  runat="server" BehaviorID="LoginStatus1_ModalPopupExtender" TargetControlID="LoginStatus1" PopupControlID="Pan1">
        
        
        <div class="site-title"></div>
        <div id="loginModalUserControl" style="display:none;">
            <uc1:LoginControl  runat="server" id="LoginControl" />
        </div>
        <nav>

        </nav>
        
        <asp:ContentPlaceHolder ID="FirstContent" runat="server">
                        
        
        
        <footer>© 2015 - site title</footer>
    </div>
    </form>
</body>
</html>

推荐答案

Login1\" ToolTip=\"User Name is required.\" ID=\"UserNameRequired\">*
</td>
</tr>
<tr>
<td align=\"right\">
<asp:Label runat=\"server\" AssociatedControlID=\"Password\" ID=\"PasswordLabel\">Password:</td>
<td>
<asp:TextBox runat=\"server\" TextMode=\"Password\" ID=\"Password\">
<asp:RequiredFieldValidator runat=\"server\" ControlToValidate=\"Password\" ErrorMessage=\"Password is required.\" ValidationGroup=\"ctl00
Login1" ToolTip="User Name is required." ID="UserNameRequired">* </td> </tr> <tr> <td align="right"> <asp:Label runat="server" AssociatedControlID="Password" ID="PasswordLabel">Password:</td> <td> <asp:TextBox runat="server" TextMode="Password" ID="Password"> <asp:RequiredFieldValidator runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ValidationGroup="ctl00


Login1\" ToolTip=\"Password is required.\" ID=\"PasswordRequired\">*
</td >
</tr>
<tr>
<td colspan=\"2\">
<asp:CheckBox runat=\"server\" Text=\"Remember me next time.\" ID=\"RememberMe\">
</td>
</tr>
<tr>
<td align=\"center\" colspan=\"2\" style=\"color: Red;\">
<asp:Label ID=\"lblTrial\" runat=\"server\" />
<asp:Literal runat=\"server\" ID=\"FailureText\" EnableViewState=\"False\" >
</td>
</tr>
<tr>
<td align=\"right\" colspan=\"2\">

<asp:Button runat=\"server\" CommandName=\"Login\" Text=\"Log In\" ValidationGroup=\"ctl00
Login1" ToolTip="Password is required." ID="PasswordRequired">* </td> </tr> <tr> <td colspan="2"> <asp:CheckBox runat="server" Text="Remember me next time." ID="RememberMe"> </td> </tr> <tr> <td align="center" colspan="2" style="color: Red;"> <asp:Label ID="lblTrial" runat="server" /> <asp:Literal runat="server" ID="FailureText" EnableViewState="False" > </td> </tr> <tr> <td align="right" colspan="2"> <asp:Button runat="server" CommandName="Login" Text="Log In" ValidationGroup="ctl00


Login1\" ID=\"LoginButton\" OnClick=\"LoginButton_Click\">

</td>
</tr>
<tr>
<td colspan=\"2\">
Not a member yet? <asp:HyperLink runat=\"server\" NavigateUrl=\"~/Signup.aspx\" ID=\"CreateUserLink\">SignUp
</td>
</tr>
</table>
</td>
</tr>
</table>
</layouttemplate>

</contenttemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID=\"Login1\" />
</triggers>


</contenttemplate>




&l t;asp:LoginStatus ID=\"LoginStatus1\" runat=\"server\" />

<ajaxToolkit:ModalPopupExtender ID=\"LoginStatus1_ModalPopupExtender\" runat=\"server\" BehaviorID=\"LoginStatus1_ModalPopupExtender\" TargetControlID=\"LoginStatus1\" PopupControlID=\"Pan1\">


<div class=\"site-title\"></div>
<div id=\"loginModalUserControl\" style=\"display:none;\">
<uc1:LoginControl runat=\"server\" id=\"LoginControl\" />
</div>
<nav>

</nav>

<asp:ContentPlaceHolder ID=\"FirstContent\" runat=\"server\">



<footer>© 2015 - site title</footer>
</div>
</form>
</body>
</html>
Login1" ID="LoginButton" OnClick="LoginButton_Click"> </td> </tr> <tr> <td colspan="2"> Not a member yet? <asp:HyperLink runat="server" NavigateUrl="~/Signup.aspx" ID="CreateUserLink">SignUp </td> </tr> </table> </td> </tr> </table> </layouttemplate> </contenttemplate> <triggers> <asp:AsyncPostBackTrigger ControlID="Login1" /> </triggers> </contenttemplate> <asp:LoginStatus ID="LoginStatus1" runat="server" /> <ajaxToolkit:ModalPopupExtender ID="LoginStatus1_ModalPopupExtender" runat="server" BehaviorID="LoginStatus1_ModalPopupExtender" TargetControlID="LoginStatus1" PopupControlID="Pan1"> <div class="site-title"></div> <div id="loginModalUserControl" style="display:none;"> <uc1:LoginControl runat="server" id="LoginControl" /> </div> <nav> </nav> <asp:ContentPlaceHolder ID="FirstContent" runat="server"> <footer>© 2015 - site title</footer> </div> </form> </body> </html>


这篇关于登录控件在updatepanel中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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