protected void Page_Load(object sender, EventArgs e) { DataTable dt = Select_Logic.selling_data(); if (dt.Rows.Count > 0) { ReportDocument data = new ReportDocument(); Total_Selling ts = new Total_Selling(); data.Load(Server.MapPath("Report_Total_Selling_Product.rpt")); //crystal report will be loaded in report document data.SetDataSource(dt); //all data will be filled in report from data table CrystalReportViewer1.ReportSource = data; //assign data in crystal report } }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == "") { Response.Redirect("LoginPage.aspx"); } DataTable dt = Select_Logic.selling_data(); dt.Columns.Add("dt_purchase_date"); foreach (DataRow dr in dt.Rows) { dr["dt_purchase_date"] = Convert.ToDateTime(dr["purchase_date"]).ToString("dd/MM/yyyy"); } grd_selling.DataSource = dt; grd_selling.DataBind(); }