Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1230
WebDialogWindow : Download report + hide at the same time
posted

I've done this sample :

http://ko.infragistics.com/products/aspnet/sample/infragistics-documents/export-to-pdf-or-xps

It works great and as I wanted...

My question is simple:

I have a WebDialogWindow with a button "Report" to create the report (as done in the sample)

I have a callback on the button click. 

What should I do close the WebDialogWindows AND download the report at the same time ? 

My code :

protected void DoSomethingOnReportButton(object sender, EventArgs e)

{

    GenerateReport();

    SendReport();

// Then I close the window...

    CreateRMADlg.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Hidden;

}

GenerateReport is not "important" here...

SendReport is :

Response.Clear();
Response.AppendHeader("content-disposition", "attachment; filename=" + documentFileNameRoot);
Response.ContentType = "application/octet-stream";
report.Publish(Response.OutputStream, exportFileFormat); 
Response.End();

What happened currently is that the report is well downloaded on my computer but the webDialogWindow doesn't hide.

(I suppose the Response.End() avoid the webDialog to go into hidden state)..

Being not a "asp.Net" specialist, could you tell me what I should do in order to download (working now) and hide webdialog ? 

Thanks

Parents
  • 49378
    posted

    Hello Nicolas,

    In this case, due to the response being consumed for downloading the report, no response is being send to the actual page on which WebDialogWindow is on and therefore no updates are applied. Therefore it would not be possible to hide the dialog window from the code-behind in this scenario. Hiding the dialog window is however possible from the client on the client click of the button initiating the response generation:

            <ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Height="300px" Width="400px">
                <ContentPane>
                    <Template>
                        <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="closeDialogWindow()" OnClick="Button1_Click" />
                    </Template>
                </ContentPane>
            </ig:WebDialogWindow>
     
            <script>
                function closeDialogWindow() {
                    var dialogWindow = $find('WebDialogWindow1');
                    dialogWindow.set_windowState(3);
                }
     
            </script>
    Attached is a sample demonstrating this in practice. Please feel free to contact me if you have any questions.
    WebDialogWindowDownloadReportAndClose.zip
Reply Children