krishnakumar kuna

krishnakumar kuna

  • NA
  • 57
  • 36.8k

Use Datatable for report viewer programatically

Oct 27 2013 12:30 PM
Hello,


I need to pass datatable to report viewer for reporting purpose programmatically ,but i am not able to fetch data inside the datatable

my code is this .

           dt.TableName = "datatable1";
                ReportDataSource odata = new ReportDataSource("DataTable1", dt);
                odata.Name = "testc";
               odata.Value = ds.Tables["dt"];
             //  ReportViewer1.LocalReport.DataSources("datatable1",dt);
                ReportViewer1.LocalReport.DataSources.Add(odata);
                ReportViewer1.DataBind();


             //  ReportDataSource source = new ReportDataSource("DataTable1", dt);
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(odata);
                ReportViewer1.DataBind();
               ReportViewer1.LocalReport.Refresh();

Answers (1)