Hi,
I have a modal popup with two radio-buttons as Excel and CSV and two buttons as download and cancel
On clicking download button i am doing the download functionality using response object.
I am trying to close the modal popup after downloading.usi ng modalpopuExtend er.hide()
But the modal popup is not hiding.
DESIGN:
Code Behind:
Please let me know what is the problem with my code.
Thank you .
Chandramohan
I have a modal popup with two radio-buttons as Excel and CSV and two buttons as download and cancel
On clicking download button i am doing the download functionality using response object.
I am trying to close the modal popup after downloading.usi ng modalpopuExtend er.hide()
But the modal popup is not hiding.
DESIGN:
Code:
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" X="600" Y="250" TargetControlID="HiddenField1" PopupControlID="Panel1" CancelControlID="btnCancel" > </cc1:ModalPopupExtender> <asp:HiddenField ID="HiddenField1" runat="server" /> <asp:Panel ID="Panel1" runat="server" width="250px" height="150px" Style="display: none;"> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <table cellspacing="2" cellpadding="2" width="350px" height="100px" style="border:1px solid black;" bgcolor="#eeeeee" > <tr> <td align="right"> Select File Type: </td> <td > <asp:RadioButtonList ID="rblFileType" runat="server" RepeatDirection="Horizontal"> <asp:ListItem Text="Excel" Value="Excel"></asp:ListItem> <asp:ListItem Text="CSV" Value="CSV"></asp:ListItem> </asp:RadioButtonList> </td> </tr> <tr> <td align="right"> </td> <td align="left"> <asp:Button ID="btnDownload" runat="server" Text="Download" CssClass="button" onclick="btnDownload_Click" /> <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="button" onclick="btnCancel_Click"/> </td> </tr> </table> </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="btnDownload" /> </Triggers> </asp:UpdatePanel> </asp:Panel> </td>
Code:
protected void btnDownload_Click(object sender, EventArgs e) { if (rblFileType.Items[0].Selected == true) { Response.Clear(); Response.Charset = ""; Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AppendHeader("Content-Disposition", "attachment; filename=Organization.xlsx"); Response.TransmitFile(Server.MapPath("~/Upload_Files/Templates/Organization.xlsx")); Response.Flush(); Response.End(); } else { Response.Clear(); Response.Charset = ""; Response.ContentType = "csv"; Response.AppendHeader("Content-Disposition", "attachment; filename=Organization.csv"); Response.TransmitFile(Server.MapPath("~/Upload_Files/Templates/Organization.csv")); Response.Flush(); Response.End(); } ModalPopupExtender1.Hide(); UpdatePanel1.Update(); }
Thank you .
Chandramohan
Comment