protected void rgIncidentList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; HiddenField hf; Label lbl; EHSIncidentData data = (EHSIncidentData)e.Item.DataItem; lbl = (Label)e.Item.FindControl("lblIncidentId"); lbl.Text = WebSiteCommon.FormatID(data.Incident.INCIDENT_ID, 6); if (data.Incident.DESCRIPTION.Length > 120) { lbl = (Label)e.Item.FindControl("lblDescription"); lbl.Text = data.Incident.DESCRIPTION.Substring(0, 117) + "..."; } lbl = (Label)e.Item.FindControl("lblDescription"); lbl.Text = HttpUtility.HtmlEncode(lbl.Text); if (data.Person != null) { lbl = (Label)e.Item.FindControl("lblReportedBy"); lbl.Text = SQMModelMgr.FormatPersonListItem(data.Person); } lbl = (Label)e.Item.FindControl("lblIncStatus"); if (data.Status == "C") { lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", "C") + " " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")"; } else if (data.Status == "C8") { lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", "C8") + " " + SQMBasePage.FormatDate((DateTime)data.Incident.CLOSE_DATE_8D, "d", false) + "<br/>(" + data.DaysToClose.ToString() + ")"; } else if (data.Status == "N") { lbl.Text = "<strong>" + WebSiteCommon.GetXlatValue("incidentStatus", "N") + "</strong>"; } else { lbl.Text = WebSiteCommon.GetXlatValue("incidentStatus", "A") + "<br/>(" + data.DaysOpen + ")"; } LinkButton lb8d = (LinkButton)e.Item.FindControl("lb8d"); LinkButton lbEditReport = (LinkButton)e.Item.FindControl("lbEditReport"); HyperLink hlReport = (HyperLink)e.Item.FindControl("hlReport"); hlReport.Visible = true; INCIDENT_ANSWER entry = data.Incident.INCIDENT_ANSWER.Where(l => l.INCIDENT_QUESTION_ID == (decimal)EHSQuestionId.Create8D).FirstOrDefault(); if (entry != null && entry.ANSWER_VALUE == "Yes") { if (UserContext.RoleAccess() > AccessMode.View) { lb8d.Visible = true; } else { lb8d.Visible = false; } lbEditReport.Visible = false; var problemCaseId = EHSIncidentMgr.SelectProblemCaseIdByIncidentId(data.Incident.INCIDENT_ID); if (problemCaseId > 0) { hlReport.NavigateUrl = "/EHS/EHS_Alert_PDF.aspx?pcid=" + EncryptionManager.Encrypt(problemCaseId.ToString()); LinkButton lbReport = (LinkButton)e.Item.FindControl("lbReport"); lbReport.Visible = true; lbReport.CommandArgument = problemCaseId.ToString(); lbReport.Attributes.Add("CaseType", data.Incident.INCIDENT_TYPE); } } else { lb8d.Visible = false; lbEditReport.Visible = true; hlReport.NavigateUrl = "/EHS/EHS_Alert_PDF.aspx?iid=" + EncryptionManager.Encrypt(data.Incident.INCIDENT_ID.ToString()); } if (data.Incident.ISSUE_TYPE_ID == 10) // Prevention Verification { lbEditReport.Visible = false; //HtmlImage imgEditReport = (HtmlImage)e.Item.FindControl("imgEditReport"); //imgEditReport.Visible = false; } if (rgIncidentList.MasterTableView.GetColumn("Attach").Visible&& data.AttachList != null) { lbl = (Label)e.Item.FindControl("lblAttach"); Ucl_Attach attch = (Ucl_Attach)Page.LoadControl("/Include/Ucl_Attach.ascx"); lbl.Parent.Controls.AddAt(lbl.Parent.Controls.IndexOf(lbl), attch); attch.BindListAttachment(data.AttachList, "", 1); } } }