Reputation: 2845
I have an rdlc file that has a datasource. But I want to assign a data table to it at runtime. Can I do this in CS file?
I want to generate a datatable at runtime and want to use it in rdlc file's object datasource. Please suggest solutions.
Upvotes: 0
Views: 1385
Reputation: 1701
You can try this
var rptSource = new ReportDataSource("TableName", objDataTable);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rptSource);
ReportViewer1.LocalReport.Refresh();
Upvotes: 3