Jonathan
Jonathan

Reputation: 32868

jQuery Dialog causing buttons not to post-back

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

After Dialog() is applied, 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?

Upvotes: 1

Views: 1158

Answers (2)

Shivam Srivastava
Shivam Srivastava

Reputation: 4596

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

Upvotes: 0

Chris Love
Chris Love

Reputation: 3893

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.

Upvotes: 2

Related Questions