Skip to main content

Search and Top Navigation

#9706 closed bug (worksforme)

Opened December 12, 2013 09:21AM UTC

Closed December 12, 2013 12:49PM UTC

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>
Attachments (0)
Change History (2)

Changed December 12, 2013 09:29AM UTC by Eneuman comment:1

_comment0: 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, "") %>; \ } \ }}} \ \ But this does not: \ {{{ \ $("#AvslutaArende").dialog({ \ autoOpen: false, \ appendTo: "#aspnetForm", \ height: 400, \ width: 800, \ modal: true, \ title: "Avsluta ärende", \ close: ResetDialog(); } \ }); \ \ function ResetDialog(){ \ <% =Page.ClientScript.GetPostBackEventReference(lbAterstallAvslutaArende, "") %>; \ } \ }}} \ 1386840971006394

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

Changed December 12, 2013 12:49PM UTC by scottgonzalez comment:2

_comment0: Here's a demo showing that the dialog is still in the correct position at the time of the `close` event. \ \ 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.1386852762902881
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.