jQuery用户界面的对话框无法在ASP.NET工作 [英] jQuery UI's Dialog doesn't work on ASP.NET
本文介绍了jQuery用户界面的对话框无法在ASP.NET工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下的测试ASPX页面:
I have the following test ASPX page:
<head runat="server">
<title></title>
<script src="js/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.6.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var dlg = $("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 300,
modal: true,
buttons: {
'Ok': function() {
__doPostBack('TreeNew', '');
$(this).dialog('close');
},
Cancel: function() {
$(this).dialog('close');
}
},
close: function() {
dlg.parent().appendTo(jQuery('form:first'));
}
});
});
function ShowDialog() {
$('#dialog').dialog('open');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="TreeNew" runat="server" Text="New"
OnClientClick="ShowDialog();return false;" onclick="TreeNew_Click"/>
<asp:Label ID="Message" runat="server"></asp:Label>
<div id="dialog" title="Select content type">
<p id="validateTips">All form fields are required.</p>
<asp:RadioButtonList ID="ContentTypeList" runat="server">
<asp:ListItem Value="1">Texte</asp:ListItem>
<asp:ListItem Value="2">Image</asp:ListItem>
<asp:ListItem Value="3">Audio</asp:ListItem>
<asp:ListItem Value="4">Video</asp:ListItem>
</asp:RadioButtonList>
</div>
</div>
</form>
</body>
</html>
我用 dlg.parent()appendTo(jQuery的('形式:第一'));
在关闭功能中检索的值。从单选按钮列表
它运作良好,但页面之前做回发的格对话框新建按钮下方移动。为什么呢?
It works well but before the page do the PostBack the div "Dialog" moves below the New button. Why?
推荐答案
我认为这是造成的,因为你在呼唤:
I think that this is caused because you are calling:
dlg.parent().appendTo(jQuery('form:first'));
在收盘时回调。这将移动的对话框。你为什么不创建对话框后,立即调用此?
at the close callback. This will move the dialog. Why don't you call this immediately after creating the dialog?
这篇关于jQuery用户界面的对话框无法在ASP.NET工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文