protected void btn_Confirm_Clcik(object sender, EventArgs e) { try { Attendance_BLL _attendancebll = new Attendance_BLL(); List <HRM_ATTENDANCE> lstHRM_ATTENDANCE = new List <HRM_ATTENDANCE>(); foreach (GridViewRow gvRow in grdview.Rows) { CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox")); HRM_ATTENDANCE _attendance = new HRM_ATTENDANCE(); if (rowChkBox.Checked == true) { Label lblEID = ((Label)gvRow.FindControl("lblEID")); Label lblWorkingDay = ((Label)gvRow.FindControl("lblWorkingDay")); Label lblAttendanceDate = ((Label)gvRow.FindControl("lblAttendanceDate")); TextBox txtbxInTime = ((TextBox)gvRow.FindControl("txtbxIntime")); TextBox txtbxOutTIme = ((TextBox)gvRow.FindControl("txtbxOuttime")); _attendance.EID = lblEID.Text; _attendance.Attendance_Date = Convert.ToDateTime(lblAttendanceDate.Text); _attendance.In_Time = TimeSpan.Parse(txtbxInTime.Text); _attendance.Out_Time = TimeSpan.Parse(txtbxOutTIme.Text); _attendance.Remarks = txtbxremark.Text; _attendance.Attendance_Process_Status = true; _attendance.OCode = ((SessionUser)Session["SessionUser"]).OCode; _attendance.Edit_Date = DateTime.Now; _attendance.Edit_User = ((SessionUser)Session["SessionUser"]).UserId; lstHRM_ATTENDANCE.Add(_attendance); } } if (lstHRM_ATTENDANCE.Count > 0) { var result = _attendancebll.Update_IndividualAttendance(lstHRM_ATTENDANCE); if (result != null) { ClearUI(); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }