本文介绍了jQuery UI 的对话框在 ASP.NET 上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我有以下测试 ASPX 页面:
<head runat="server"><标题></标题><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><脚本类型="文本/javascript">$(函数(){var dlg = $("#dialog").dialog({bgiframe:是的,自动打开:假,身高:300,模态:真,纽扣: {'好的':函数(){__doPostBack('TreeNew', '');$(this).dialog('close');},取消:函数(){$(this).dialog('close');}},关闭:函数(){dlg.parent().appendTo(jQuery('form:first'));}});});函数显示对话框(){$('#dialog').dialog('open');}</脚本></头><身体><form id="form1" runat="server"><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="选择内容类型"><p id="validateTips">所有表单字段都是必需的.</p><asp:RadioButtonList ID="ContentTypeList" runat="server"><asp:ListItem Value="1">Texte</asp:ListItem><asp:ListItem Value="2">图片</asp:ListItem><asp:ListItem Value="3">音频</asp:ListItem><asp:ListItem Value="4">视频</asp:ListItem></asp:RadioButtonList></div></div></表格></身体></html>我在 close function 上使用 dlg.parent().appendTo(jQuery('form:first')); 从 RadioButtonList.
它运行良好,但在页面执行 PostBack 之前,div对话框"移动到新建按钮下方.为什么?
解决方案 我认为这是因为你在调用:
dlg.parent().appendTo(jQuery('form:first'));
在关闭回调时.这将移动对话框.为什么不在创建对话框后立即调用它?
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>
I use dlg.parent().appendTo(jQuery('form:first')); on close function to retreive the values from RadioButtonList.
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 UI 的对话框在 ASP.NET 上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End
相关推荐
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11
C#/.NET开发问题
2
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11
C#/.NET开发问题
14
热门文章
1阅读完 JSON 内容后遇到的附加文本:
2Excel 错误 HRESULT: 0x800A03EC 尝试使用单元格名称获取范围
3承载错误 - invalid_token - 未找到签名密钥
4反序列化 Newtonsoft.Json 中的自定义异常
5RabbitMQ 连接错误没有一个指定的端点是可达的"
6“由于系统缺乏足够的缓冲区空间或队列已满,无法对套接字执行操作"
7使用 System.IdentityModel.Tokens.Jwt 解码和验证 JWT 令牌
8Linq - 在多个 (OR) 条件下进行左连接
热门精品源码
最新VIP资源
1多功能实用站长工具箱html功能模板
2多风格简历在线生成程序网页模板
3论文相似度查询系统源码
4响应式旅游景点宣传推广页面模板
5在线起名宣传推广网站源码
6酷黑微信小程序网站开发宣传页模板
7房产销售交易中介网站模板
8小学作业自动生成程序

大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)