How to Call SSRS Report in ASP.NET Project

We know SQL Server Reporting Services or SSRS is a server based reporting system. Like other reporting system (Crystal Report or rdlc) we do not need to design UI. It has built in mechanism to automatically generate some input related UI like Calendar, DropDownList, Input TextBox etc based on reports parameter. We can easily call a SSRS report through web browser.

But we can also call them from our ASP.NET project.

Design SSRS Report
Call SSRS Report

Design SSRS Report

Step 1
Design your SSRS report by using report designing tools. You can use Visual Studio or ReportBuilder.

Step 2
Include a Report Viewer in .aspx page.

Step 3
Include a ScriptManager in that page [if required].

Step 4
Include a button.
1. Register the Microsoft.Reporting.WebForms into your ASPX page.


<%@ Register Assembly=”Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
Namespace=”Microsoft.Reporting.WebForms” TagPrefix=”rsweb” %>
2. After registering the assembly you will be able to use ReportViewer control to fetch reports on your ASPX page. Below is the code for ReportViewer Control on ASPX page.

<rsweb:ReportViewer runat=”server” ID=”MyReportViewer” Width=”100%” Height=”700px”>
3. Now, please find below code, which you will need to write into your ASPX.cs file…


protected void Page_Load(object sender, EventArgs e)
string reportPath = string.Empty;
string sReportFileName = string.Empty;
FileInfo fi = null;

Int32 counter = 0;
SSRS.ParameterValue[] parameters = new SSRS.ParameterValue[dictParam.Count];
foreach (KeyValuePair<string, string> kvp in dictParam)
Console.WriteLine(“Key = {0}, Value = {1}”,
kvp.Key, kvp.Value);

// Prepare report parameters

parameters[counter] = new SSRS.ParameterValue();
parameters[counter].Name = kvp.Key;
parameters[counter].Value = kvp.Value;
counter = counter + 1;

rs1.SetExecutionParameters2(parameters, null);
MyReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
MyReportViewer.ServerReport.ReportServerUrl = new Uri(“http://reportserver/erports&#8221;); // Report Server URL
MyReportViewer.ServerReport.ReportPath = “EmployeeReport”; // Report Name
MyReportViewer.ShowParameterPrompts = false;
MyReportViewer.ShowPrintButton = true;

// Below code demonstrate the Parameter passing method. User only if you have parameters into the reports.
Microsoft.Reporting.WebForms.ReportParameter[] reportParameterCollection = new Microsoft.Reporting.WebForms.ReportParameter[1];
reportParameterCollection[0] = new Microsoft.Reporting.WebForms.ReportParameter();
reportParameterCollection[0].Name = Perks.Constants.Pages.ClientAdmin.ShowInvoice.QueryStrings.INVOICEID;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.