This is a migrated thread and some comments may be shown as answers.

ClientEvents-OnResponseEnd event of RadAjaxManager not firing in Safari browser

3 Answers 215 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
SARAVANA KUMAR
Top achievements
Rank 1
SARAVANA KUMAR asked on 10 Nov 2016, 02:27 PM

Hi,

I have a rad button in a rad window, with both client click and on server event. the page in which the rad window is there has a radajaxmanager and a rad grid. The server event handles the export of radgrid data to an excel, this is an ajax request. I do not want to use the gridexporting. The following code exports the file:

 using (ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook())
        {
            var worksheet = wb.Worksheets.Add(datatable, fileName);
            worksheet.Tables.First().ShowAutoFilter = false;
            worksheet.Tables.First().Theme = ClosedXML.Excel.XLTableTheme.None;

httpContext.Response.Clear();
            httpContext.Response.Buffer = true;
            httpContext.Response.Charset = Encoding.UTF8.WebName;
            httpContext.Response.AddHeader("content-disposition", string.Format("{0}{1}", "attachment;filename=", fileName));
            httpContext.Response.ContentType = contentType;

using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())

            {
                workbook.SaveAs(memoryStream);
                memoryStream.WriteTo(httpContext.Response.OutputStream);
                httpContext.Response.Flush();
                httpContext.Response.End();
            }

}

After exporting the file, the ClientEvents-OnResponseEnd of radajaxmanager is not firing in Safari browser on MAC, I want this event to be fired to hide an image. It is firing in IE and Chrome on both MAC and windows but not in Safari. Please suggest.

Thanks in advance.

Saravana

 

3 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 15 Nov 2016, 06:02 AM
Hello Saravana,

Exporting within an AJAX request is not supported and you should use the approach demonstrated in the following help article for temporarily disabling the AJAX when the export button is clicked:
In your case you will have to use the ID of the custom button that you are using for initiating the export.

Hope this helps.


Regards,
Konstantin Dikov
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
0
SARAVANA KUMAR
Top achievements
Rank 1
answered on 18 Nov 2016, 10:58 AM

Hi Konstantin,

Thanks for the quick reply. But the link that you provided is using radgrid's exporting method, as I mentioned in my question, I am not using RadGrid.MasterTableView.Export, I am using datatable(datasource of the grid) to export file using the code that I pasted in my above question. Also my scenario is quite different that the one mentioned in the link.

A page has a rad grid which is ajaxified using a radajax manager, and on the same page there is a button "Export", when user clicks on the button a rad window opens up with a drop down to select the export format (xlsx,xls or txt) and a "Submit" button, on selecting a format and clicking on "Submit" button, in the onclientclick I close the rad window and on the server side event I call the method to export the file. The issue is, this "Submit" button request is going as an Ajax request and the file gets downloaded, but the OnResponseEnd event of the RadAjaxManager does not fire after the download is complete, only in Safari browser.

Will be extremely helpful if I get a solution for this problem. Please let me know if you need more information.

Thanks in advance.

Saravana

 

0
Konstantin Dikov
Telerik team
answered on 23 Nov 2016, 08:47 AM
Hi Saravana,

I have to say that I am curious how this is working in other browser, because downloading within an AJAX request is not supported and the button that initiates the download must initiate a full postback (which was the main purpose of sharing the approach used in RadGrid. The same approach could be used for any other control, including a simple button). Detailed information on this matter can be found at the following forum threads:

Best Regards,
Konstantin Dikov
Telerik by Progress
Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Tags
Ajax
Asked by
SARAVANA KUMAR
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
SARAVANA KUMAR
Top achievements
Rank 1
Share this question
or