protected void PerfectAttendanceCDL() { string strWrite = ""; int intCtr = 0; DateTime dteCurrentDateFrom = DateTime.Now; DateTime dteCurrentDateTo = DateTime.Now; using (clsTimeSheetPeriod tsp = new clsTimeSheetPeriod()) { tsp.TimeSheetPeriodCode = clsTimeSheetPeriod.GetCurrentPosted(); tsp.Fill(); dteCurrentDateFrom = clsDateTime.GetDateOnly(tsp.PeriodFrom); dteCurrentDateTo = clsDateTime.GetDateOnly(tsp.PeriodTo); //DateTime dteFrom = Convert.ToDateTime("4/1/2011"); //DateTime dteTo = Convert.ToDateTime("4/30/2011"); //dteCurrentDateFrom = clsDateTime.GetDateOnly(dteFrom); //dteCurrentDateTo = Convert.ToDateTime(dteTo); } Response.Write("<table><tr><td><img src='Support/star32.png' /></td><td><b><span class='HeaderText'> Perfect Attendance! (month of " + dteCurrentDateFrom.ToString("MMMM") + ")</span></b></td></tr></table><br />"); //DataTable tblPerfectAttendance = clsTimesheet.DSGARPerfectAttendancePortalCDL(clsDateTime.GetMonthFirstWorkingDay(dteCurrentDateFrom), dteCurrentDateTo); DataTable tblPerfectAttendance = clsTimesheet.DSGARPerfectAttendancePortalCDL(dteCurrentDateFrom, dteCurrentDateTo); foreach (DataRow drw in tblPerfectAttendance.Rows) { if ((float)intCtr % 5 == 0) { strWrite += "<tr>"; } strWrite += "<td style='width:20%; text-align:center;'>" + "<div class='border' style='height:100%;'>" + "<table width='100%' cellpadding='3' cellspacing='1'>" + "<tr>" + "<td class='GridRows'>" + "<table>" + "<tr><td><img src='http://hq.sti.edu/Pictures/realpicture/" + (File.Exists(Server.MapPath("~/pictures/realpicture/") + drw["username"].ToString() + ".jpg") ? drw["username"].ToString() + ".jpg" : "default.jpg") + "' width='100' height='100'></td></tr>" + "<tr><td><a href='Userpage/UserPage.aspx?username="******"username"] + "'>" + drw["NickName"] + "</a></td></tr>" + "</table>" + "</td>" + "</tr>" + "</table>" + "</div>" + "</td>"; intCtr += 1; if ((float)intCtr % 5 == 0) { strWrite += "</tr>"; } } if (intCtr == 0) { Response.Write("<table style='width:100%'><tr><td style='text-align:center;font-size:small;'>No perfect attendance for this month</td></tr></table>"); } else { Response.Write("<table style='width:100%'>" + strWrite + "</table>"); } }