Opened 9 years ago

Closed 9 years ago

#9706 closed bug (worksforme)

appendTo not working with close event

Reported by: Eneuman Owned by:
Priority: minor Milestone: none
Component: ui.dialog Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

I'm using asp.net 4.0 with ajax. I'm using appenTo option to attach the dialog to my form. AJAX is working fine from within the dialog but if I do a ajax postback, when the dialog is closing, the hole page gets refreshed, not just the update panel containing my lbAterstallAvslutaArende link button. This used to work in 1.9.1

To me It seems like the close event is working "outside" of the appendTo context, and thats why MS Ajax cannot find any updatepanel to update.

My code that's failing:

$("#AvslutaArende").dialog({
  autoOpen: false,
  appendTo: "#aspnetForm",
  height: 400,
  width: 800,
  modal: true,
  title: "Avsluta ärende",
  close: function(event, ui) { <% =Page.ClientScript.GetPostBackEventReference(lbAterstallAvslutaArende, "") %> }
    });
<asp:UpdatePanel runat="server" ID="upAterstallAvslutaArende" UpdateMode="Conditional">
  <ContentTemplate>
    <asp:LinkButton runat="server" ID="lbAterstallAvslutaArende" OnClick="lbAterstallAvslutaArende_OnClick"/>
  </ContentTemplate>
</asp:UpdatePanel>

Change History (2)

comment:1 Changed 9 years ago by Eneuman

Doing a postback works fine as long as I don't do it from the close event:

This works:

  ResetDialog();

  function ResetDialog(){
    <% =Page.ClientScript.GetPostBackEventReference(lbAterstallAvslutaArende, "") %>;
  }

and this works:

$("#AvslutaArende").dialog({
  autoOpen: false,
  appendTo: "#aspnetForm",
  height: 400,
  width: 800,
  modal: true,
  title: "Avsluta ärende",
  open: ResetDialog(); }
    });

  function ResetDialog(){
    <% =Page.ClientScript.GetPostBackEventReference(lbAterstallAvslutaArende, "") %>;
  }

But this is not working:

$("#AvslutaArende").dialog({
  autoOpen: false,
  appendTo: "#aspnetForm",
  height: 400,
  width: 800,
  modal: true,
  title: "Avsluta ärende",
  close: ResetDialog(); }
    });

  function ResetDialog(){
    <% =Page.ClientScript.GetPostBackEventReference(lbAterstallAvslutaArende, "") %>;
  }
Last edited 9 years ago by Eneuman (previous) (diff)

comment:2 Changed 9 years ago by Scott González

Resolution: worksforme
Status: newclosed

Here's a demo showing that the dialog is still in the correct position at the time of the close event: http://jsbin.com/ekiYaDOP/1/edit

Since postbacks are .NET-specific, we'll need a reduced test case that doesn't use .NET which shows the problem you're trying to describe. I'm going to close this since the jsbin shows that this is working properly. If you can provide a reduced test case showing a problem inside jQuery UI, we'll reopen. But it sounds like you'll need .NET help, not jQuery UI help.

Last edited 9 years ago by Scott González (previous) (diff)
Note: See TracTickets for help on using tickets.