I have a page which contains a dropdownlist and reportviewer, and I use dropdownlist.selectValue as my parameter to query, and build a datatable I want
My question is: How to bind the code-behind datatable to RDLC and how to show on reportviewer
Do a lot of googling and find the closet result https://blogs.msdn.microsoft.com/sqlforum/2011/04/27/walkthrough-assign-dataset-dynamically-created-in-code-to-your-local-report-with-reportviewer/
Only one error
this.DataTable1BindingSource.DataSource = ds;
this.reportViewer1.RefreshReport();
I guess this exactly is where rdlc bind my coded datatable.
But I can't find DataTable1BindingSource
aspx
<asp:ScriptManager runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" >
<LocalReport ReportPath="Report1.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="DataSet1TableAdapters."></asp:ObjectDataSource>
cs
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
code dataset and datatable here
}
Expect rdlc bind my own coded datatable
this.ObjectDataSource1
? - JohnD