开发者

jQuery Dialog causing buttons not to post-back

开发者 https://www.devze.com 2022-12-25 11:45 出处:网络
I\'m using the jQuery UI Dialog() function on an ASP.NET webform, on a particular panel. After Dialog() is applied,开发者_StackOverflow the buttons become useless and will not post back at all; I\'m

I'm using the jQuery UI Dialog() function on an ASP.NET webform, on a particular panel.

After Dialog() is applied,开发者_StackOverflow the buttons become useless and will not post back at all; I'm not even getting a Page_Load event firing, let alone any button events.

Is the Dialog function messing with my button events? If so, is there a way to fix this?


My guess is since you are using WebForms your actaul dialog is outside the one tag you get in WebForms. You can check this by viewing the source, or better yet opening the IE Developer tools (F12) and then selecting the dialog. You can then see where your buttons are in the DOM.

The other thing, remember in WebForms all the controls have to well be controls that runat=server. If you are using pure HTML then you need to assign the acciont of the button's click event in the JavaScript.


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

精彩评论

暂无评论...
验证码 换一张
取 消