更新面板中的登录控件



我在主页面上放置了一个loginstatus控件,并添加了扩展器(ModalPopupExtender)。登录控件位于一个面板内,单击登录时会显示登录控件(在sqlserver2008r2中,用户和成员表也是由登录控件创建的)。

但当我点击登录按钮时,使用错误的ID/Pass,什么都不会发生。使用updatepanel的postbacktrigger会导致整页回发,modalpopup消失,我必须再次单击loginstat才能查看显示的失败文本。

如果有一种方法可以在更新面板中显示错误文本,请提供指导

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Frontend.master.cs" Inherits="FashionReplica.MasterPages.Frontend" %>
<%@ 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>My Site Title</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<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">
        <Scripts>
            <asp:ScriptReference Path="~/Scripts/jquery-2.1.4.min.js" />
        </Scripts>
    </asp:ScriptManager>    
<div>
    <asp:UpdatePanel UpdateMode="Conditional" runat="server">
        <ContentTemplate>
    <asp:Panel runat="server" ID="Pan1" CssClass="modalPopup">                
            <asp:Login ID="Login1" runat="server" CreateUserText="SignUp" CreateUserUrl="~/Signup.aspx" FailureText="Wrong ID/Password"></asp:Login>
        </asp:Panel>
            </ContentTemplate>
    </asp:UpdatePanel>
    <asp:LoginStatus ID="LoginStatus1" runat="server" />
    <ajaxToolkit:ModalPopupExtender ID="LoginStatus1_ModalPopupExtender" runat="server" CancelControlID="btnCancle" BehaviorID="LoginStatus1_ModalPopupExtender" TargetControlID="LoginStatus1" PopupControlID="Pan1">
    </ajaxToolkit:ModalPopupExtender>
    <div class="site-title"><a href="http://p2p.wrox.com/Default.aspx">Site Title</a></div>
    <div id="loginModalUserControl" style="display:none;">
        <uc1:LoginControl runat="server" id="LoginControl" />
    </div>
    <nav>
        <ul id="menu">
            <li>
            <a href="http://p2p.wrox.com/Default.aspx">Home</a>
               </li>
            <li>
                <a href="http://p2p.wrox.com/About.aspx">About Us</a>
            </li>
            <li>
                <a href="http://p2p.wrox.com/Conact.aspx">Conact Us</a>
            </li>
            <li>
                <a href="http://p2p.wrox.com/Management/Add Brand.aspx">Add Brand</a>
            </li>
        </ul>
    </nav>
    <asp:ContentPlaceHolder ID="FirstContent" runat="server">
    </asp:ContentPlaceHolder>
    <footer>© 2016 - Site Title</footer>
</div>
</form>

在UpdatePanel 中设置UpdateMode="Conditional"ChildrenAsTriggers="false"

相关内容

  • 没有找到相关文章

最新更新