Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
My dialog has an UpdatePanel wrapping it's content so the data is updated on postback when loading the form data to edit. This works fine, but the dialog does not close when the "Save" button (specified as the AcceptButton) is clicked.
It will close if the content is not wrapped in the UpdatePanel, but then my content is not updated on postback.
How do I get it to close automatically when saving?
<eo:Dialog ID="CustomerNotes" AcceptButton="Save" runat="server" Height="242px" Width="320px" HeaderHtml="Customer Notes" AllowResize="True" ControlSkinID="None" ResizeImageUrl="00020014" RestoreButtonUrl="00070103" CloseButtonUrl="00070101" ShadowColor="Gray" ShadowDepth="3" BackShadeColor="Gray" BackShadeOpacity="55" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px"> <ContentTemplate> <asp:UpdatePanel ID="CustomerNotesPanel" runat="server" UpdateMode="Always"> <ContentTemplate> <div> <br /> To add a note about this title, enter it below and click Save.<br /><br /> <asp:TextBox ID="CustomerNote" runat="server" TextMode="MultiLine" MaxLength="950" style="width: 450px; height: 200px;"></asp:TextBox> <br /><br /> <center> <asp:Button ID="Save" runat="server" Text="Save" OnClick="Save_Click" / </center> <asp:Label ID="dialogOrderID" runat="server" Text="" Visible="false"></asp:Label> </div> </ContentTemplate> </asp:UpdatePanel> </ContentTemplate> <HeaderStyleActive CssClass="DialogHeader" /> <FooterStyleActive CssClass="DialogFooter" /> <ContentStyleActive CssClass="DialogContent" /> </eo:Dialog>
|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
I added OnClientClick="eo_GetObject('CustomerNotes').close();" to the Save button. It closes the dialog immediatley and executes the postback to save the the notes.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Your solution would work fine. We tried your previous code and it works fine here too. We had to make two changes:
1. Put another link button to show the dialog because the dialog is initially invisible; 2. Remove "Save_Click" OnClick handler for the Save button;
In order to troubleshoot the problem, it is important to understand how the dialog is closed. Click a button does not automatically close the dialog. What it does is that it causes the page to be posted back and the whole page to be reloaded. Since the dialog is invisible when initially loaded, that's why when you click the button the dialog closes. Obviously this behavior can be modified by your code behind. So you may want to check those first.
Closing the dialog through JavaScript would always work because it doesn't go back to the server.
Thanks
|