I've a ReportViewer(.rdlc)
in my app. I want to show a datatable
, which is generated dynamically from codebehind, in Reportviewer in Table object.
How to do this? dataset has to be sent to report through codebehind.
I Have My Code Behind file
DataTable dt = Session["ReportOnUser"] as DataTable;
if (dt.Rows.Count > 0)
{
ReportDataSource rds = new ReportDataSource("ReportOnUser", dt);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
}
aspx file:
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="800px">
<LocalReport ReportPath="Reports\Report1.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ReportOnUser" Name="ReportOnUser" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
I have adde an rdlc file with No design or xsd file Report1.rdlc.