Page_Init
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using CrystalDecisions.Shared; using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.CrystalReports; public partial class Employee_Reports_Forms_frmPrnt_attendance_Summary : System.Web.UI.Page { Common cmnsql = new Common(); ReportDocument RptDoc; DataDefinition df; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session["RptDoc"] = null; RptDoc = null; if (Request.QueryString["Title"] != null) { hid_RprtTitle.Value = Convert.ToString(Request.QueryString["Title"]); } hid_unm.Value = Convert.ToString(Session["UName"]); hid_RprtName.Value = Convert.ToString(Session["Report_Name"]); hid_CompCode.Value = Convert.ToString(Session["Comp_Code"]); hid_MonYr.Value = Convert.ToString(Session["MonYr"]); if (Session["Val"] != null) { hid_Val.Value = Convert.ToString(Session["Val"]); } else { hid_Val.Value = ""; } LoadReport(); } } private void LoadReport() { try { string Rprt_Name = "~\\FAS_Reports\\" + hid_RprtName.Value; DataTable dtattend = (DataTable)Session["dtattend"]; RptDoc = new ReportDocument(); RptDoc.Load(Server.MapPath(Rprt_Name)); RptDoc.SetDataSource(dtattend); df = RptDoc.DataDefinition; RptDoc.Load(Server.MapPath(Rprt_Name)); CrystalReportViewer1.ReportSource = RptDoc; CrystalReportViewer1.ID = "DownloadedReport"; Session["RptDoc"]= RptDoc; } catch (Exception) { return; } } private void Page_Init(object sender, EventArgs e) { if (Session["RptDoc"] != null) { CrystalReportViewer1.ReportSource = (ReportDocument)Session["RptDoc"]; CrystalReportViewer1.DataBind(); } } }
Page_Load()
Page_Init()
try-catch
if (!IsPostBack)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)