水晶报表显示到aspx页面中
2013-06-25 11:03 Evan.Pei 阅读(235) 评论(0) 收藏 举报1.在前台添加水晶报表显示控件。
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
2.后台添加绑定代码。
protected void Page_Load(object sender, EventArgs e)
{
//创建报表文档
ReportDocument myReport = new ReportDocument();
//取到报表文件物理路径
string reportPath = Server.MapPath("CrystalReport1.rpt");
myReport.Load(reportPath);
//将创建的新的报表文档绑定
this.CrystalReportViewer1.ReportSource = myReport;
this.CrystalReportViewer1.DataBind();
}
浙公网安备 33010602011771号