views:

179

answers:

1

Hello experts!

I've recently started working with SSRS 2008 and ASP.Net. I must develop a report with 3 different levels of detail. So, I decided the best solution was to develop 3 different reports and provide some drill-through mechanism in order to allow navigation. For that, I set the 'Action' property of one of the textboxes to 'Go to report' and set the correct url.

The parameters passed to the report need to be validated first. So, for a matter of flexibility and better user experience I let the user enter the parameters using standard ASP.Net controls. When the user clics on my custom button 'Show report' the following code executes:

        ReportViewer2.ServerReport.ReportPath = ".. my report path ..";
        ReportViewer2.ServerReport.ReportServerUrl = new Uri(".. my report url ..");
        ReportParameter p1 = new ReportParameter("dateStart", dateStart.ToString());
        ReportParameter p2 = new ReportParameter("dateEnd", dateEnd.ToString());
        ReportViewer2.ServerReport.SetParameters(p1);
        ReportViewer2.ServerReport.SetParameters(p2);
        ReportViewer2.ServerReport.Refresh(); 

Then the report is shown, but the links for navigating to the other reports don't work. You may notice that the parameters added are visible, thus letting me press the 'View Report' button wich is embedded inside the report viewer. If I do so, the report is rendered again and then everithing is Ok. It's like the ReportViewer.ServerReport.Refresh() method is missing something.

That's a problem, because the requirements states that the parameteres need to be hidden.

When I execute the report from inside VS or the Report Server the links work ok, but in those cases I always must press the standard 'View Report' button.

Is this a bug of the ReportViewer control or am I missing something here? Thanks in advance.

Regards,

Gonzalo.

A: 

The report viewer contains an update panel. You must call the Update method of the update panel in the pre-render event of the report viewer:

protected void ReportViewer2_PreRender(object sender, EventArgs e) { ((UpdatePanel)this.ReportViewer2.Controls[1]).Update(); }