protected void grdSanitizationReport_RowDataBound(object sender, GridViewRowEventArgs e) { if ((e.Row.RowType == DataControlRowType.DataRow))// && (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)) { try { #region fields //Label lblDateAndTime = (Label)e.Row.FindControl("lblDateAndTime"); Label lblSanitizationStartDate = (Label)e.Row.FindControl("lblSanitizationStartDate"); Label lblSanitizationEndDate = (Label)e.Row.FindControl("lblSanitizationEndDate"); Label lblTagStatus = (Label)e.Row.FindControl("lblTagStatus"); Label lblHoldTimeInMinute = (Label)e.Row.FindControl("lblHoldTimeInMinute"); try { if (lblTagStatus != null && lblSanitizationEndDate != null && lblHoldTimeInMinute != null) { lblTagStatus.ForeColor = Color.White; lblHoldTimeInMinute.ForeColor = Color.White; if (ML_Common.string2Decimal(lblHoldTimeInMinute.Text) >= 5 && !string.IsNullOrEmpty(lblSanitizationEndDate.Text)) { lblTagStatus.Text = "Pass"; e.Row.Cells[11].BackColor = Color.Green; e.Row.Cells[12].BackColor = Color.Green; } else { lblTagStatus.Text = "Fail"; e.Row.Cells[11].BackColor = Color.Red; e.Row.Cells[12].BackColor = Color.Red; } } } catch (Exception ex) { Exception exc = ex; } Label lblIsConfirm = (Label)e.Row.FindControl("lblIsConfirm"); if (lblIsConfirm != null) { try { if (!string.IsNullOrEmpty(lblIsConfirm.Text)) { if (lblIsConfirm.Text.Trim() == "1" || lblIsConfirm.Text.Trim().ToLower() == "true") { lblIsConfirm.ForeColor = Color.White; lblIsConfirm.Text = "Completed"; e.Row.Cells[13].BackColor = Color.Green; } else { lblIsConfirm.ForeColor = Color.White; lblIsConfirm.Text = "Pending"; e.Row.Cells[13].BackColor = Color.Red; } } else { lblIsConfirm.ForeColor = Color.White; lblIsConfirm.Text = "Pending"; e.Row.Cells[13].BackColor = Color.Red; } } catch (Exception ex) { Exception exc = ex; } } Label lblRemarks = (Label)e.Row.FindControl("lblRemarks"); if (lblRemarks != null) { try { lblRemarks.Text = ML_Common.string2Eclips(lblRemarks.Text, 30); } catch (Exception ex) { lblRemarks.Text = string.Empty; Exception exc = ex; } } #endregion } catch (Exception ex) { Exception exc = ex; } } }