private void CheckIsDeducted() { try { //int ResionId = Convert.ToInt32(ddlRegion1.SelectedValue); //int OfficeId = Convert.ToInt32(ddlOffice1.SelectedValue); //int DeptId = Convert.ToInt32(ddlDept1.SelectedValue); //int sction = Convert.ToInt32(ddlSection.SelectedValue); //int subsction = Convert.ToInt32(ddlSubSections.SelectedValue); Attendance_BLL _attendancebll = new Attendance_BLL(); //List<HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetSalaryDeductionByEID(ResionId, OfficeId, DeptId, sction, subsction, Convert.ToDateTime(txtDate.Text)); DateTime deductionDate = Convert.ToDateTime(txtDate.Text); List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetSalaryDeductionByEID(deductionDate); if (employess.Count > 0) { foreach (GridViewRow gvRow in grdview.Rows) { Label lblEID = ((Label)gvRow.FindControl("lblEID")); CheckBox Checkbox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox")); DropDownList ddl = ((DropDownList)gvRow.FindControl("ddlSalaryDeductType")); string eid = lblEID.Text; var ispage = employess.FirstOrDefault(x => x.EID == eid && x.SalaryDeductDate == deductionDate); if (ispage != null) { double?mm = ispage.salaryDeductDay; if (mm > 0.5) { ddl.SelectedValue = "Full Day"; } else { ddl.SelectedValue = "Half Day"; } Checkbox.Checked = true; } else { Checkbox.Checked = false; } } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }