我正在使用 jquery UI 对话框来修改 ASP.NET 网站中的数据行,当打开对话框时,我将对话框附加到底层表单,这使我可以使用回发。$('#' + id).parent().appendTo($("form"));
但是当我设置对话框属性时,modal: true
不仅背景是灰色的,对话框也是灰色的,无法访问。
如果我删除$('#' + id).parent().appendTo($("form"));
它,它就像应该的那样工作,但是我不能使用回发。
我做错了什么还是我错过了让它发挥作用的一点?
.aspx 顶部的 Javascript
<script type="text/javascript">
$(document).ready(function () {
$('#workDialog').dialog({
autoOpen: false,
draggable: true,
resizable: false,
width: 800,
height: "auto",
modal: true
});
});
function showDialog(id) {
$('#' + id).parent().appendTo($("form"));
$('#' + id).dialog("open");
}
function closeModalDiv(id) {
$('#' + id).dialog("close");
}
</script>
包含对话框的 div
<div id="workDialog" title="Basic dialog">
<asp:UpdatePanel ID="upWorkDialog" runat="server" UpdateMode="Conditional"> <ContentTemplate>
<table id="Table1" class="item">
<tr>
...
</tr>
<tr>
<td><asp:TextBox ID="txt...></asp:TextBox></td>
<td><asp:TextBox ID="txt...></asp:TextBox></td>
<td><asp:TextBox ID="txt...></asp:TextBox></td>
<td><asp:TextBox ID="txt...></asp:TextBox></td>
</tr>
</table>
<asp:Label ID="lblWorkEditError" runat="server" Text=""></asp:Label>
<asp:Button ID="btnSave" runat="server" Text="Gem" OnClick="btnSave_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Annuller" OnClientClick="javascript:closeModalDiv('workDialog');" />
</ContentTemplate></asp:UpdatePanel>
</div>