Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReportViewer 2010 not refreshing on async postback

Ok I've have been searching and trying different ideas for a good six hours and I have not found a solution.

I'm using Visual Studio 2010, C#, ASP.Net 4.0 and ReportViewer 10.

I have a javascript function that makes a async call to refresh report parameters with new values and then reloads the report. Everything executes as expected but the report does not render the new data.

If I do a normal postback from a button then it works, but as soon as it is a async postback it doesn't. I have read something that the rendering might be to late in the page life-cycle etc. but this has left me nowhere. Here is the code I use to set the parameters.

Code Behind:

//Tried with and without this line and it makes no differed
ReportViewer1.Reset();
ReportViewer1.ProcessingMode = ProcessingMode.Remote;

List<ReportParameter> rParams = new List<ReportParameter>();
rParams.Add(new ReportParameter("UserID", SelectedUserID.ToString(), false));
rParams.Add(new ReportParameter("PayrollSalesMonthID", "13", false));
ReportViewer1.ServerReport.ReportServerUrl = new Uri("...");
ReportViewer1.ServerReport.ReportPath = "...";

ReportViewer1.ServerReport.SetParameters(rParams);
//Tried with and without this line and it makes no differed
ReportViewer1.ServerReport.Refresh();

Markup:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" BorderStyle="None" Width="100%" Height="98%" SizeToReportContent="true" AsyncRendering="true" />
</rsweb:ReportViewer>

UPDATE

I have both a ASP Script Manager and a EXT.Net Resource Manager on my page as below and this is causing the error. As soon as I remove the Resource Manager it works fine but I do need it for other functionality on this page. Also putting the report in an iFrame is out the of the question.

<ext:ResourceManager ID="ResourceManager1" runat="server" Locale="en-GB" />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

Any ideas on how to get these two Managers to play along nicely?

like image 596
Eugene Niemand Avatar asked Nov 19 '25 23:11

Eugene Niemand


1 Answers

Have you set scriptmanager.EnablePartialRendering flag to true?

like image 136
rt2800 Avatar answered Nov 21 '25 13:11

rt2800