Reputation: 99
I have created an ASP.NET Empty Web Application in VS 2012 using the .NET Framework 4.5. I have also added a report to this project. Inside the Web.Config I have set my connection string.
When working on the report I do not have an option to add a DataSource like I do when working in Windows Form Application. I want to connect this web app to a object from a library.
Edit: Why can we not access Object Datasource Type when the a library reference is added to the project? Why does a helper class have to be added to access the library objects. Here is what has to be done to achieve this: here
Upvotes: 1
Views: 1239
Reputation: 45500
You can do it programmatically:
ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));
dt
would be your dataTable
EDIT:
<rsweb:ReportViewer ID="ReportViewer1" runat="server">
<LocalReport ReportEmbeddedResource="Report1.rdlc" ReportPath="Report1.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server">
</asp:ObjectDataSource>
Upvotes: 2