1. First of all open Visual Studio 2008 then go to New >> Website
2. Then Browse the directory where you want to save New Web Site.
3. Now in your web page add following controls:
- One ScriptManager
- One Button
- One MicrosoftReportViewer
4. Now add following code on button’s click event in your .cs file :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| using Microsoft.Reporting.WebForms; try { MyReportViewer.ProcessingMode = ProcessingMode.Remote; MyReportViewer.ServerReport.ReportPath = "/StartSSRS/PersonAddressDetails" ; MyReportViewer.ServerReport.Refresh(); ReportParameter[] reportParameterCollection = new ReportParameter[1]; //Array size describes the number of paramaters. reportParameterCollection[0] = new ReportParameter(); reportParameterCollection[0].Name = "City" ; //Give Your Parameter Name reportParameterCollection[0].Values.Add( "Seattle" ); //Pass Parametrs's value here. MyReportViewer.ServerReport.SetParameters(reportParameterCollection); MyReportViewer.ServerReport.Refresh(); } catch (Exception ex) { Response.Write(ex.ToString()); } |
5. Now Run your website and click on Get Report Button.
It will show following results in your web page :
It will show following results in your web page :
Congratulations! We successfully called our Parameterized SSRS report from ASP.NET web application.