带有 ASP.NET 按钮回发的 jQuery UI 对话框 [英] jQuery UI Dialog with ASP.NET button postback
本文介绍了带有 ASP.NET 按钮回发的 jQuery UI 对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个在我的 ASP.NET 页面上运行良好的 jQuery UI 对话框:
jQuery(function() {jQuery("#dialog").dialog({可拖动:真实,可调整大小:真实,显示:'转移',隐藏:'转移',宽度:320,自动打开:假,最小高度:10,最小宽度:10});});jQuery(文档).准备好(函数(){jQuery("#button_id").click(function(e) {jQuery('#dialog').dialog('option', 'position', [e.pageX + 10, e.pageY + 10]);jQuery('#dialog').dialog('打开');});});
我的 div:
但是 btnButton_Click 从来没有被调用过......我该如何解决?
更多信息:我添加了此代码以将 div 移动到表单:
jQuery("#dialog").parent().appendTo(jQuery("form:first"));
但还是没有成功...
解决方案
您已经接近解决方案了,只是得到了错误的对象.应该是这样的:
jQuery(function() {var dlg = jQuery("#dialog").dialog({可拖动:真实,可调整大小:真实,显示:'转移',隐藏:'转移',宽度:320,自动打开:假,最小高度:10,最小宽度:10});dlg.parent().appendTo(jQuery("form:first"));});
I have a jQuery UI Dialog working great on my ASP.NET page:
jQuery(function() {
jQuery("#dialog").dialog({
draggable: true,
resizable: true,
show: 'Transfer',
hide: 'Transfer',
width: 320,
autoOpen: false,
minHeight: 10,
minwidth: 10
});
});
jQuery(document).ready(function() {
jQuery("#button_id").click(function(e) {
jQuery('#dialog').dialog('option', 'position', [e.pageX + 10, e.pageY + 10]);
jQuery('#dialog').dialog('open');
});
});
My div:
<div id="dialog" style="text-align: left;display: none;">
<asp:Button ID="btnButton" runat="server" Text="Button" onclick="btnButton_Click" />
</div>
But the btnButton_Click is never called... How can I solve that?
More information: I added this code to move div to form:
jQuery("#dialog").parent().appendTo(jQuery("form:first"));
But still without success...
解决方案
You are close to the solution, just getting the wrong object. It should be like this:
jQuery(function() {
var dlg = jQuery("#dialog").dialog({
draggable: true,
resizable: true,
show: 'Transfer',
hide: 'Transfer',
width: 320,
autoOpen: false,
minHeight: 10,
minwidth: 10
});
dlg.parent().appendTo(jQuery("form:first"));
});
这篇关于带有 ASP.NET 按钮回发的 jQuery UI 对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文