标签:style blog http io ar color os sp for
前台拉个报表控件
<rsweb:ReportViewer ID="rptQuery" runat="server" Font-Names="Verdana" Font-Size="10pt"
InteractiveDeviceInfos="(集合)" WaitMessageFont-Names="Verdana" SizeToReportContent="true"
WaitMessageFont-Size="10pt" PageCountMode="Actual">
</rsweb:ReportViewer>
后台绑定
public void BindReport()
{
string sortField = "DepartmentID";
string sortDirection = " ASC";
//获取报表数据
StatisticAnalysis StatisticAnalysisBll = new StatisticAnalysis();
IList<StatisticAnalysisInfo> StatisticAnalysisQueryList = new List<StatisticAnalysisInfo>();
StatisticAnalysisQueryList = StatisticAnalysisBll.StatisticAnalysisGetQueryResultNotPaged(DateOperator,BeginDate, EndDate,sortField, sortDirection);
//绑定报表
rptQuery.LocalReport.ReportPath = MapPath("StatisticAnalysisQueryReport.rdlc");
ReportDataSource StatisticAnalysisQuery = new ReportDataSource("StatisticAnalysisQuery", StatisticAnalysisQueryList);//引号中名字和RDLC数据集中的名字要一致
rptQuery.LocalReport.DataSources.Clear();
rptQuery.LocalReport.DataSources.Add(StatisticAnalysisQuery);
//传递报表参数
//string queryItem = (query.Item.Trim().Length == 0) ? "" : query.Item;
//ReportParameter paramItem = new ReportParameter("Item", queryItem);
//rptQuery.LocalReport.SetParameters(paramItem);
//刷新RDLC报表
rptQuery.LocalReport.Refresh();
}
标签:style blog http io ar color os sp for
原文地址:http://www.cnblogs.com/zhumengmeng/p/4108447.html