jQuery UI的对话框使用ASP.NET按钮回传 [英] jQuery UI Dialog with ASP.NET button postback

查看:153
本文介绍了jQuery UI的对话框使用ASP.NET按钮回传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jQuery用户界面对话框我的ASP.NET页面上伟大的工作:

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');
    });
});

DIV我:

<div id="dialog" style="text-align: left;display: none;">
    <asp:Button ID="btnButton" runat="server" Text="Button" onclick="btnButton_Click" />
</div>

但btnButton_Click永远不会被调用......我该如何解决呢?

But the btnButton_Click is never called... How can I solve that?

更多信息:我加了这个$​​ C $ C到DIV移动到形式:

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"));
});

这篇关于jQuery UI的对话框使用ASP.NET按钮回传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆