1
votes

I am using ReportViewer control in my asp.net web application.

There is a button called View Report, the following code is in the asp.net button Click event which loads the report. The parameters are selected on the web page and passed on to ReportViewer control as shown below. This works fine.

rptvw.ProcessingMode = ProcessingMode.Remote;
rptvw.ServerReport.ReportServerUrl = new Uri("http://localhost:90/reportserver");
rptvw.ServerReport.ReportPath = "/Reports/Dashboard1";

var param = new ReportParameter[2];
param[0] = new ReportParameter("Parameter1", dropdownlist1.SelectedItem.Text))
param[1] = new ReportParameter("Parameter2", dropdownlist2.SelectedItem.Text));
rptvw.ServerReport.SetParameters(param);
rptvw.ServerReport.Refresh();

I have 3 separate reports (.rdl files) for example Dashboard2, Dasboard3 and Dashboard4. On Dashboard1 (.rdl file) report there are actions, links, when clicked it loads Dashboard2, Dashboard3 and 4 reports.

My problem is how can the web page know which report is loaded so that I can apply the relevant parameters when View Report button is clicked and display the respective report?

Which ReportViewer web control eventcan I use to determine which report is loaded?

1
so you have create sub report and set parameter. – Sender
Thanks for your reply. Yes. I have created another report Dashboard2 which opens up when a link is clicked on Dashboard1 and the parameters from Dashboard1 are passed to the Dashboard2. But the Idea is to change the parameters from the Web page rather than on Dashboard2 report. Hope it makes sense. – Savvy

1 Answers

1
votes

What I feel from your question and the code that you have supplied is that this View Report button click will always show the Dashboard1 report and upon clicking the links you will display other related reports. So parameters are supposed to be passed from this report where you click the link and not from the web-page.

You can check this for more information.

So there should actually be no question of passing the values to parameters from web-page when you clicking somewhere else.

HTH