I am at a loss. This issue seems pretty serious to me. I have a jQuery
dialog with an update panel in it. When I use the ui script version 1.7.2
my postback events FAIL. Works perfectly with 1.7.1. Below is how I
created the dialog and panel. The 'btnAddNote' is the button that is NOT
posting back with version 1.7.2
<div id="notesDialog" title="Notes" style="display:none;width:590px;">
<asp:UpdatePanel ID="upNotes" runat="server" UpdateMode="Conditional"
ChildrenAsTriggers="true">
<ContentTemplate>
<asp:Label ID="lblNotesErrors" runat="server" EnableViewState
="false" CssClass="ErrorMessage" EnableTheming="false" />
<asp:Panel ID="pnlNotesConfirmation" runat="Server"
HorizontalAlign="Center" style="display:none">
<br /><div>You have entered in unsaved notes.<br /><br />Would
you like to save your notes before closing this screen?</div><br />
<asp:button ID="btnYesSaveNote" runat="server" Width="100px"
Text="Yes" OnClick="btnYesSaveNote_Click" /> <input type="button"
ID="btnNoSaveNote" Width="100px" value="No"
onclick="NotesDialog().dialog('option',
'beforeclose', function(event, ui) {return true;});
NotesDialog().dialog('close');" />
</asp:Panel>
<asp:Panel ID="pnlNotes" runat="Server" Visible="true">
<table style="text-align:left">
<tr><td colspan="2" align="center"><asp:
RequiredFieldValidator id="reqSubject" runat="server" ErrorMessage="You must
enter a subject to add a note." ControlToValidate="txtSubject"
ValidationGroup="notes" Display="dynamic"></asp:RequiredFieldValidator></td
></tr>
<tr>
<td><asp:Label id="lblSubject" runat="server"
EnableViewState="false">Subject:</asp:Label> </td>
<td><asp:TextBox id="txtSubject" runat="server"
Width="500px" AutoCompleteType="disabled"></asp:TextBox></td>
</tr>
<tr><td colspan="2" align="center"><asp:
RequiredFieldValidator id="reqField" runat="server" ErrorMessage="Please
enter Note text" ControlToValidate="txtNote" ValidationGroup="notes" Display
="dynamic"></asp:RequiredFieldValidator></td></tr>
<tr>
<td> </td>
<td><asp:TextBox id="txtNote" runat="server"
TextMode="MultiLine" Height="82px" Width="500px" AutoCompleteType
="disabled"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2" align="right"><asp:Button id
="btnAddNote" runat="server" Text="Add Note" Width="100px" OnClick
="btnAddNote_Click" /></td>
</tr>
</table>
<asp:HiddenField ID="hidStakeholderId" runat="server" />
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAddNote" EventName
="Click" />
</Triggers>
</asp:UpdatePanel>
<div id="notesControlHistory" style="display:block;width:560px">
<span class="H3" style="text-align:left">History</span><br />
<span id="spnNotesNav" style="text-align:left"></span>
<div style="height:250px;overflow:auto;overflow-x:hidden">
<table id="tblNotesHistory" cellpadding="0" cellspacing="0"
align="left" style="text-align:left" class="DisplayTable" width="98%">
</table>
</div>
</div>
</div>
On Fri, Nov 20, 2009 at 9:28 AM, Nabeal Ahmed <[email protected]> wrote:
> Roger on the else return true.
>
> FYI, it works even if you don't have that.
>
> On Fri, Nov 20, 2009 at 9:17 AM, Fontzter <[email protected]> wrote:
>
>> Yes, your CloseNotesDialog() function should have an
>>
>> else return true;
>>
>> at the end.
>>
>> Then in the call you could just do it like this (no need for the extra
>> anonymous function):
>>
>> beforeclose: CloseNotesDialog
>>
>> Also, your code above was missing the comma between the options (right
>> after your beforeclose function and before the buttons option.
>>
>> Hth,
>>
>> Dave
>>
>> On Nov 20, 9:08 am, Mean Mike <[email protected]> wrote:
>> > opps sorry I spoke a little to soon... I figured out what your doing
>> >
>> > when before returns false it prevents the dialog from closing
>> > so really quite opposite of what I said previously in fact its a great
>> > way to determine if a dialog should close or not
>> >
>> > hth
>> > Mike
>> >
>> > On Nov 20, 9:00 am, Mean Mike <[email protected]> wrote:
>> >
>> > > I think your confused about what beforeclose does,
>> >
>> > > beforeclose doesn't close a dialog it does whatever you put in its
>> > > function right after dialog('close') is called
>> >
>> > > so you would do somthing like this
>> >
>> > > $(document).ready(function() {
>> > > $('#notesDialog').dialog({
>> > > autoOpen: false,
>> > > width: 590,
>> > > resizable: false,
>> > > draggable: false,
>> > > bgiframe: true,
>> > > modal: true,
>> > > beforeclose: function(event, ui) {
>> > > return CloseNotesDialog();
>> > > }
>> > > buttons: {
>> > > OK: function() {
>> > > $(this).dialog('close');
>> > > }
>> > > }
>> > > });
>> > > });
>> >
>> > > function CloseNotesDialog()
>> > > {
>> > > var subject = $('#<%= txtSubject.ClientID %>');
>> > > var note = $('#<%= txtNote.ClientID %>');
>> >
>> > > if (subject.val() != '' || note.val() != '')
>> > > {
>> > > var pnlNotes = $('#<%= pnlNotes.ClientID %>');
>> > > var pnlNotesConfirmation = $('#<
>> > > %=pnlNotesConfirmation.ClientID %>');
>> >
>> > > pnlNotesConfirmation.height(pnlNotes.height());
>> > > pnlNotes.hide();
>> > > pnlNotesConfirmation.show();
>> >
>> > > return false;
>> > > }
>> > > }
>> >
>> > > and when the user clicks "OK" your CloseNoteDialog() function would be
>> > > called
>> >
>> > > if your trying to determine if the dialog should close or not your
>> > > should do that in "OK"'s funtion
>> >
>> > > Make sense ?
>> >
>> > > Mike
>> >
>> > > On Nov 19, 10:24 am, Nabeal <[email protected]> wrote:
>> >
>> > > > I'm at a loss. I have hooked a beforeclose function, and that works
>> > > > fine.
>> > > > The issue that is killing me is when I want to close the dialog
>> after
>> > > > the beforeclose returns false, nothing happens!!
>> > > > On the pnlNotesConfirmation there is a "No" button. On that "No" I
>> > > > try to perform: $('#notesDialog').dialog('close'); No event action
>> > > > occurs.
>> >
>> > > > I tried the following line first: $('#notesDialog').dialog('option',
>> > > > 'beforeclose', function(ev, ui) {return true;});
>> > > > Still it doesn't close.
>> >
>> > > > The only way I got to work was by doing a destroy ($
>> > > > ('#notesDialog').dialog('destroy'); ) then re init the dialog. That
>> > > > can't be right. What am I doing wrong.
>> > > > Using 1.7.2
>> >
>> > > > $(document).ready(function() {
>> > > > $('#notesDialog').dialog({
>> > > > autoOpen: false,
>> > > > width: 590,
>> > > > resizable: false,
>> > > > draggable: false,
>> > > > bgiframe: true,
>> > > > modal: true,
>> > > > beforeclose: function(event, ui) { return
>> CloseNotesDialog
>> > > > (); }
>> > > > });
>> > > > });
>> >
>> > > > function CloseNotesDialog()
>> > > > {
>> > > > var subject = $('#<%= txtSubject.ClientID %>');
>> > > > var note = $('#<%= txtNote.ClientID %>');
>> >
>> > > > if (subject.val() != '' || note.val() != '')
>> > > > {
>> > > > var pnlNotes = $('#<%= pnlNotes.ClientID %>');
>> > > > var pnlNotesConfirmation = $('#<%=
>> > > > pnlNotesConfirmation.ClientID %>');
>> >
>> > > > pnlNotesConfirmation.height(pnlNotes.height());
>> > > > pnlNotes.hide();
>> > > > pnlNotesConfirmation.show();
>> >
>> > > > return false;
>> > > > }
>> > > > }
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "jQuery UI" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<jquery-ui%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/jquery-ui?hl=.
>>
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en.