//protected void btnPdf_Click(object sender, EventArgs e) //{ // site = new DBSite(); // ExamMarksBll eBll = new ExamMarksBll(); // CreateReportCard(site, eBll); //} public void CreateReportCard(DBSite site, ExamMarksBll eBll) { foreach (GridViewRow gr in gridView1.Rows) { int StudentMasterId = util.CheckNullInt(gr.Cells[2].Text); int clasId = util.CheckNullInt(gridView1.DataKeys[gr.RowIndex].Values["classId"]); int sectionId = util.CheckNullInt(gridView1.DataKeys[gr.RowIndex].Values["SectionId"]); string studentName = util.CheckNull(gr.Cells[3].Text); string ClassName = util.CheckNull(gr.Cells[4].Text); string SectionName = util.CheckNull(gr.Cells[5].Text); DataTable dt = eBll.GetResultDT(site, StudentMasterId, clasId, sectionId); string fileName = studentName + "_" + ClassName + "_" + SectionName + ".pdf"; string pth = Server.MapPath("~/ReportCard/" + fileName); string yr = Util_BLL.User.fYear + "-" + (util.CheckNullInt(Util_BLL.User.fYear) + 1); util.ExportToPdf(dt, pth, studentName, ClassName, SectionName, yr); } }