我有一個登錄控制設置出現在jQuery對話框中。但是,在對話框中登錄按鈕不起作用,當我刪除對話框時,它工作正常。有一些用戶名和密碼的域驗證器做了一些javascript驗證,所以我認爲可能會有一些衝突,但我無法弄清楚。有任何想法嗎?jQuery的.NET登錄控件對話框不工作?
這裏是我的標記:
<div id="loginBox">
<asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false">
<LayoutTemplate>
<span class="failureNotification">
<asp:Literal ID="FailureText" runat="server"></asp:Literal>
</span>
<div class="accountInfo" style="float: left; width: 220px;">
<fieldset class="login">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label>
<asp:TextBox ID="UserName" runat="server" CssClass="textEntry" Width="190"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
CssClass="red-text" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" >Password:</asp:Label>
<asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password" Width="190"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
CssClass="red-text" ErrorMessage="Password is required." ToolTip="Password is required."
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator><br/>
<asp:CheckBox ID="RememberMe" runat="server" style="display: inline-block;" />
<asp:Label ID="RememberMeLabel" runat="server" AssociatedControlID="RememberMe" style="display: inline-block; font-weight: normal;">Remember Me</asp:Label>
</fieldset>
<p class="submitButton">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="LoginUserValidationGroup" />
</p>
</div>
<div style="float: left; width: 170px; padding-top: 15px;">
<asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" CssClass="red-text" ValidationGroup="LoginUserValidationGroup" />
</div>
<div class="clearfix"></div>
</LayoutTemplate>
</asp:Login>
</div>
jQuery的:在代碼隱藏文件
<script type="text/javascript">
$(document).ready(function() {
// Dialog
$('#loginBox').dialog({
autoOpen: true,
width: 420,
modal: true,
draggable: false,
title: "<h2 style='margin-bottom: 0px;'>Log In</h2>",
closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); },
resizable: false,
show: { effect: "fade", duration: 1500 }
});
})
</script>
沒有。我注意到,當我檢查登錄按鈕的頁面已經呈現它有這個就可以了之後:
<input type="submit" name="ctl00$mainbody$LoginUser$LoginButton" value="Log In" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$mainbody$LoginUser$LoginButton", "", true, "LoginUserValidationGroup", "", false, false))" id="mainbody_LoginUser_LoginButton">
所以我猜測,JavaScript是不是由於某種原因,運行時,它出現在對話框中,但我不知道如何解決它。
這似乎是問題,但我如何通過JavaScript重新連接控件到窗體? – SventoryMang
沒關係我得到它的工作:'$('#loginBox')。parent()。appendTo(jQuery('form:first'));' – SventoryMang
你確實是怎麼做到的;) –