Goal: Invoke SSRS reports in child window (javascript popup window) which renders the report in excel format and prompt the user to open/save/cancel dialog box. While child window rendering the report, user can perform other task on main page.
MainPage--------->calling javascript to open popupwindow --------->childwindow rendering the excel report
Implementation:
btnClick event: Tried following 3 ways
if (System.Web.Configuration.WebConfigurationManager.AppSettings["ReportFormat"].ToString() == "1")
{
PageAsyncTask asyncTask = new PageAsyncTask(BeginGetAsyncData, EndGetAsyncData, TimeoutDoSomething, true);
Page.RegisterAsyncTask(asyncTask);
Page.ExecuteRegisteredAsyncTasks();
}
Javascript:
function callSSRSReport(reportURL) {
var childWin = window.open("EExport.aspx?ReportName=" + reportURL, "ssrs", "width=250, height=150, menubar=no,toolbar=no, statusbar=no, resizable=yes, scrollbars=yes, location=no");
}
EExport.aspx:
This page using the ReportViewer control to render and display the excel open/save/cancel dialog box to the user.
Problem:
After invoking the SSRS report (popup window) through javascript, Main page seems like idle but when I perform any other task Main page is not responding until the popup screen done with rendering the report. This is defeating the purpose of having implementing
SSRS report in our application. Also I tried calling the report directly from Main page (without using popup), with this option if control move to different page excel dialog box not appearing.
Please let me know what is going wrong with this code.
sham
Member
161 Points
109 Posts
Webforms Async call not working
Apr 27, 2012 03:06 AM|LINK
Hi Guys,
Async call is not working in following case.
Goal: Invoke SSRS reports in child window (javascript popup window) which renders the report in excel format and prompt the user to open/save/cancel dialog box. While child window rendering the report, user can perform other task on main page.
MainPage--------->calling javascript to open popupwindow --------->childwindow rendering the excel report
Implementation:
btnClick event: Tried following 3 ways
if (System.Web.Configuration.WebConfigurationManager.AppSettings["ReportFormat"].ToString() == "1")
{
PageAsyncTask asyncTask = new PageAsyncTask(BeginGetAsyncData, EndGetAsyncData, TimeoutDoSomething, true);
Page.RegisterAsyncTask(asyncTask);
Page.ExecuteRegisteredAsyncTasks();
}
IAsyncResult BeginGetAsyncData(Object src, EventArgs args, AsyncCallback cb, Object state)
{
//return myRequest.BeginGetResponse(cb, state);
_dlgt = new AsyncTaskDelegate(DoTheAsyncTask);
IAsyncResult result = _dlgt.BeginInvoke(cb, state);
return result;
}
void EndGetAsyncData(IAsyncResult ar)
{
//System.Net.WebResponse myResponse = myRequest.EndGetResponse(ar);
//myResponse.Close();
_dlgt.EndInvoke(ar);
}
------------------------------------------------------------------------------------------------
if (System.Web.Configuration.WebConfigurationManager.AppSettings["ReportFormat"].ToString() == "3")
{
var taskSSRS = new Task(() => DoTheAsyncTask());
taskSSRS.Start();
}
-----------------------------------------------------------------------------------------------------
if (System.Web.Configuration.WebConfigurationManager.AppSettings["ReportFormat"].ToString() == "4")
{
var outer = Task.Factory.StartNew(() =>
{
var child = Task.Factory.StartNew(() =>
{
DoTheAsyncTask();
});
});
outer.wait();
}
DoTheAsynTask() method calls following javascript:
age.ClientScript.RegisterStartupScript(this.GetType(), "callReport", "javascript:callSSRSReport('" + reportURL + "');", true);
Javascript:
function callSSRSReport(reportURL) {
var childWin = window.open("EExport.aspx?ReportName=" + reportURL, "ssrs", "width=250, height=150, menubar=no,toolbar=no, statusbar=no, resizable=yes, scrollbars=yes, location=no");
}
EExport.aspx:
This page using the ReportViewer control to render and display the excel open/save/cancel dialog box to the user.
Problem:
After invoking the SSRS report (popup window) through javascript, Main page seems like idle but when I perform any other task Main page is not responding until the popup screen done with rendering the report. This is defeating the purpose of having implementing SSRS report in our application. Also I tried calling the report directly from Main page (without using popup), with this option if control move to different page excel dialog box not appearing.
Please let me know what is going wrong with this code.
Thanks
Sham