//protected void txtEid_AT_TextChanged(object sender, EventArgs e) //{ // try // { // string OCODE = ((SessionUser)Session["SessionUser"]).OCode; // string employeeID = Convert.ToString(txtEid_AT.Text); // Emp_IMG_AT.ImageUrl = "EmployeeIMG.ashx?eId=" + employeeID + "&oCode=" + OCODE; // var result = objAttendanceReasonBll.GetEmployeeDetailsID(employeeID, OCODE).ToList(); // if (result.Count > 0) // { // var objNewEmp = result.First(); // txtEid_AT.Text = Convert.ToString(objNewEmp.EID); // txtEmpName_AT.Text = Convert.ToString(objNewEmp.EMP_FIRSTNAME + " " + objNewEmp.EMP_LASTNAME); // lblHiddenId.Text = Convert.ToString(objNewEmp.EMP_ID); // txtDepartment_AT.Text = objNewEmp.DPT_NAME; // txtDesignation_AT.Text = objNewEmp.DEG_NAME; // lblShiftCode.Text = objNewEmp.SHIFTCODE; // shifted_TotalHour = objNewEmp.Shift_TotalHour; // } // else // { // //NO RECORDS FOUND. // } // } // catch (Exception ex) // { // throw ex; // } //} void BindGridEmployeeAttendance() { try { string OCODE = ((SessionUser)Session["SessionUser"]).OCode; using (ERPSSLHBEntities context = new ERPSSLHBEntities()) { if (context.HRM_ATTENDANCE.Count() > 0) { var row = objAtt_BLL.GetAttendanceByShift_Date(OCODE, ddlShiftCode.SelectedItem.Text).ToList(); if (row.Count > 0) { GridViewEMP_AT.DataSource = row.ToList(); GridViewEMP_AT.DataBind(); } } else { var obj = new List <HRM_ATTENDANCE>(); obj.Add(new HRM_ATTENDANCE()); // Bind the DataTable which contain a blank row to the GridView GridViewEMP_AT.DataSource = obj; GridViewEMP_AT.DataBind(); int columnsCount = GridViewEMP_AT.Columns.Count; GridViewEMP_AT.Rows[0].Cells.Clear(); // clear all the cells in the row GridViewEMP_AT.Rows[0].Cells.Add(new TableCell()); //add a new blank cell GridViewEMP_AT.Rows[0].Cells[0].ColumnSpan = columnsCount; //set the column span to the new added cell GridViewEMP_AT.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center; GridViewEMP_AT.Rows[0].Cells[0].ForeColor = System.Drawing.Color.Red; GridViewEMP_AT.Rows[0].Cells[0].Font.Bold = true; //set No Results found to the new added cell GridViewEMP_AT.Rows[0].Cells[0].Text = "NO RECORDS FOUND!"; } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }