Saturday, October 31, 2015

Call SSRS Report With Prameters from ASP.NET Web Application





1. First of all open Visual Studio 2008 then go to New >> Website
Call SSRS Report With Parameters From ASP.NET-1
2. Then Browse the directory where you want to save New Web Site.
Call SSRS Report With Parameters From ASP.NET-2
3. Now in your web page add following controls:
  • One ScriptManager
  • One Button
  • One MicrosoftReportViewer
So your web page design will look like following:Call SSRS Report With Parameters From ASP.NET-3
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.ReportServerUrl = new Uri("http://bhushan-pc:8080/ReportServer");
   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());
}
Call SSRS Report With Parameters From ASP.NET-4
5. Now Run your website and click on Get Report Button.
It will show following results in your web page :
Call SSRS Report With Parameters From ASP.NET-5
Congratulations! We successfully called our Parameterized SSRS report from ASP.NET web application.

Call SSRS Report From ASP.NET





Call SSRS Report From ASP.NET

To call SSRS Report from ASP.NET Web application, go through below steps : 1. First of all open Visual Studio 2008 then go to  New >> WebsiteCall SSRS Report From ASP.NET-1   2. Then Browse the directory where you want to save New Web Site. Call SSRS Report From ASP.NET-23. Now In your web page add following controls:
  • One ScriptManager
  • One Button
  • One MicrosoftReportViewer
So your web page design will look like following: Call SSRS Report From ASP.NET-34. 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
using Microsoft.Reporting.WebForms;
try
{
    MyReportViewer.ProcessingMode = ProcessingMode.Remote;
    MyReportViewer.ServerReport.ReportServerUrl = new Uri("http://bhushan-pc:8080/ReportServer");
    MyReportViewer.ServerReport.ReportPath = "/StartSSRS/PersonAddressDetails";
    MyReportViewer.ServerReport.Refresh();
}
catch (Exception ex)
{
    Response.Write(ex.ToString());
}
Call SSRS Report From ASP.NET-45. Now Run your website and click on Get Report Button. It will show following results shown in web page : Call SSRS Report From ASP.NET-5Congratulations! We successfully called our SSRS report from ASP.NET web application.