HTML代码
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
.cs代码
EmployeeDBBroker EDB = new EmployeeDBBroker();
DataSet ds = EDB.GetListofemployeebyCategory(Convert.ToInt32(department),Convert.ToInt32(category));
lbCollegeName.Text = ds.Tables[0].Rows[0]["DName"].ToString();
DataTable dt = new DataTable();
if (ds.Tables[0].Rows.Count > 0)
dt = ds.Tables[0];
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("Cry_ListofEmployee.rpt"));
Student dsCustomers = GetData();
crystalReport.SetDataSource(ds);
CrystalReportViewer1.ReportSource = crystalReport;
CrystalReportViewer1.RefreshReport()