tags:

views:

459

answers:

4

Is it possible to integrate SSRS reports to the webforms..an example will be enough to keep me moving.

A: 

http://msdn.microsoft.com/en-us/library/ms152899.aspx

info from MS

mattlant
A: 

this is a knowledge base article which describes how to render report output to an aspx page in a particular file format.

http://support.microsoft.com/kb/875447/en-us

+4  A: 

Absolutely it is.

What you are looking for is the ReportViewer control, located in the Microsoft.Reporting.WebForms assembly. It will allow you to place a control right on your web form that will give people an interface for setting report parameters and getting the report.

Alternatively you can set all the parameters yourself and output the report in whatever format you need. We use it in our application to output PDF.

For instance - this is how we setup a reportviewer object for one of our reports and get the PDF, and then send it back to the user. The particular code block is a web handler.

public void ProcessRequest(HttpContext context)
{
    string report = null;
    int managerId = -1;
    int planId = -1;
    GetParametersFromSession(context.Session, out report, out managerId, out planId);
    if (report == null || managerId == -1 || planId == -1)
    {
        return;
    }

    CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;

    List<ReportParameter> parameters = new List<ReportParameter>();
    parameters.Add(new ReportParameter("Prefix", report));
    parameters.Add(new ReportParameter("ManagerId", managerId.ToString()));
    parameters.Add(new ReportParameter("ActionPlanId", planId.ToString()));
    string language = Thread.CurrentThread.CurrentCulture.Name;
    language = String.Format("{0}_{1}", language.Substring(0, 2), language.Substring(3, 2).ToLower());
    parameters.Add(new ReportParameter("Lang", language));

    ReportViewer rv = new ReportViewer();
    rv.ProcessingMode = ProcessingMode.Remote;
    rv.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServer"]);
    if (ConfigurationManager.AppSettings["DbYear"] == "2007")
    {
        rv.ServerReport.ReportPath = "/ActionPlanning/Plan";
    }
    else
    {
        rv.ServerReport.ReportPath = String.Format("/ActionPlanning{0}/Plan", ConfigurationManager.AppSettings["DbYear"]);
    }
    rv.ServerReport.SetParameters(parameters);

    string mimeType = null;
    string encoding = null;
    string extension = null;
    string[] streamIds = null;
    Warning[] warnings = null;
    byte[] output = rv.ServerReport.Render("pdf", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

    context.Response.ContentType = mimeType;
    context.Response.BinaryWrite(output);
}
John Christensen
A: 

Be warned that you will lose some functionality such as the parameter selection stuff when you do not use the URL Access method.

Report server URL access supports HTML Viewer and the extended functionality of the report toolbar. The SOAP API does not support this type of rendered report. You need to design and develop your own report toolbar, if you render reports using SOAP.

http://msdn.microsoft.com/en-us/library/ms155089.aspx

Bob Albright