使用ASP.NET按钮提交表单的jQuery UI对话框

12 浏览
0 Comments

使用ASP.NET按钮提交表单的jQuery UI对话框

我在我的ASP.NET页面上成功地使用了jQuery UI Dialog:

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:

    

但是btnButton_Click从未被调用... 我该如何解决这个问题?

更多信息:我添加了这段代码将div移到表单中:

jQuery("#dialog").parent().appendTo(jQuery("form:first"));

但是仍然没有成功...

admin 更改状态以发布 2023年5月23日
0
0 Comments

$('#divname').parent().appendTo($("form:first"));

使用这段代码解决了我的问题,并且它在每个浏览器中都能够工作,包括Internet Explorer 7,Firefox 3和Google Chrome。 我开始喜欢jQuery… 它是一个很酷的框架。

我还测试了部分呈现,正是我一直在寻找的。太棒了!


...
...

...
...
    
       
          postback test
          
          
          

0
0 Comments

你离答案很近了,只是获取了错误的对象。应该是这样的:

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

0