0

I am trying to fill RDLC report with Typed dataset. I am trying to fill it via code but don't know that what to Put in specific places.

Name of dataset is GPSDBDataSet.XSD, Name of Report if Report.rdlc, Name of datatable is Coordinates.

using Microsoft.Reporting.WebForms;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ReportViewer1.Visible = true;

            ReportDataSource rds = new ReportDataSource();

            ReportViewer1.Reset();

            ReportViewer1.ProcessingMode = ProcessingMode.Local;

            LocalReport rep = ReportViewer1.LocalReport;                      

            rep.Refresh();

            rep.ReportPath = "Report.rdlc";


            rds.Name = ???????;


            rds.Value = ????;

            rep.DataSources.Add(rds);
    }
}
user3518032
  • 423
  • 8
  • 25

1 Answers1

2

Its been a while, but try this.

rds.name = "yourdatasetname" // in your case this till be coodinates

rds.value = ds.table[0];

Code DataSet ds = new DataSet();

try
{
    ds = RetrieveData();//some func that returns dataset...
    ReportDataSource reportDataSource = new ReportDataSource();
    // Must match the DataSource in the RDLC
    reportDataSource.Name = "DataSet1";//coordinates in your case.
    reportDataSource.Value = ds.Tables[0];
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.LocalReport.DataSources.Add(reportDataSource);
    ReportViewer1.LocalReport.Refresh();

}
catch (Exception Ex)
{
    throw new Exception("Error Generating the Report", Ex);
}
sylar
  • 366
  • 2
  • 9
  • Report Viewer Configuration Error The Report Viewer Web Control HTTP Handler has not been registered – user3518032 Apr 22 '14 at 08:19
  • You need to add few lines to your web.config and you will be all set. http://msdn.microsoft.com/en-us/library/ms251661.aspx http://forums.asp.net/t/1360494.aspx?IIS+7+and+Reportviewer Its a very common problem and googling that error text will show you alot of results. – sylar Apr 22 '14 at 13:39