protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CRHelperClass db = new CRHelperClass(); CRProductReport cr = new CRProductReport(); cr.SetDataSource(db.GetData()); CrystalReportViewer1.ReportSource = cr; } }
public ActionResult ViewReport() { CRHelperClass cRHelper = new CRHelperClass(); CRProductReport cRProduct = new CRProductReport(); cRProduct.SetDataSource(cRHelper.GetData()); System.IO.Stream model = cRProduct.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); return(File(model, "application/pdf")); }