Using ReportViewer in ASP.NET 4.0 and Entity Framework

To bind a data source to a reportviewer:

Add this line after <%@ Page … ,

<%@ Register Assembly=”Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
Namespace=”Microsoft.Reporting.WebForms” TagPrefix=”rsweb” %>

<rsweb:ReportViewer ID=”ReportName” BorderStyle=”Solid” BorderColor=”Gray”
BorderWidth=”1px” runat=”server” Font-Names=”Verdana” Font-Size=”8pt” InteractiveDeviceInfos=”(Collection)”
WaitMessageFont-Names=”Verdana” WaitMessageFont-Size=”14pt” Width=”100%” Height=”470px”>
<LocalReport ReportPath=”ReportPath.rdlc”>
</LocalReport>
</rsweb:ReportViewer>

At the code behind,

DataSource _datasource = new DataSource();
ReportDataSource itm = new ReportDataSource(“ReportDataSourceName”, _datasource.GetDataSourceList(this.HiddenField.Value));

To setup parameters of reportviewer:

var messageParam = new ReportParameter(“Message”, Value);

this.ReportName.LocalReport.SetParameters(new[] { messageParam });

Conclusion: This blog need to be edited further.
References:

http://heathesh.com/category/LINQ.aspx

Advertisements
This entry was posted in .NET Framework 4, C# 4.0 AND ASP.NET 4.0, Linq to Entity, Visual Studio 2010. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s