protected void gridMerchantList_ItemDataBound(object sender, GridItemEventArgs e) { try { if (e.Item is GridDataItem) { GridDataItem dataBoundItem = e.Item as GridDataItem; TableCell statusCell = dataBoundItem["StatusDescription"]; Label lblStatus = (Label)dataBoundItem.FindControl("lblStatus"); string statusDesc = ""; if (lblStatus != null) { statusDesc = lblStatus.Text.ToLower(); } switch (statusDesc) { case "pre-enrolled": statusCell.BackColor = System.Drawing.Color.BurlyWood; break; case "enrolled": statusCell.BackColor = System.Drawing.Color.Gray; break; case "active": statusCell.BackColor = System.Drawing.Color.Green; break; case "suspended": statusCell.BackColor = System.Drawing.ColorTranslator.FromHtml("#F00000"); break; case "cancelled": statusCell.BackColor = System.Drawing.Color.Black; break; case "denied": statusCell.BackColor = System.Drawing.ColorTranslator.FromHtml("#680000"); break; } TableCell uwStatusCell = dataBoundItem["UnderwritingStatusDescription"]; Label lblUWStatus = (Label)dataBoundItem.FindControl("lblUWStatus"); string uwStatusDesc = ""; if (lblUWStatus != null) { uwStatusDesc = lblUWStatus.Text.ToLower(); } switch (uwStatusDesc) { case "pending": uwStatusCell.ForeColor = System.Drawing.Color.DarkGray; break; case "approved": uwStatusCell.ForeColor = System.Drawing.Color.Green; break; case "denied": uwStatusCell.ForeColor = System.Drawing.ColorTranslator.FromHtml("#680000"); break; case "outdated": uwStatusCell.ForeColor = System.Drawing.Color.Red; break; case "cancelled": uwStatusCell.ForeColor = System.Drawing.Color.Black; break; } } if (e.Item is GridFilteringItem) { GridFilteringItem filterItem = (GridFilteringItem)e.Item; filterItem["RecordId"].HorizontalAlign = HorizontalAlign.Center; filterItem["CorpName"].HorizontalAlign = HorizontalAlign.Center; filterItem["MerchantPrincipal.Contact.FirstName"].HorizontalAlign = HorizontalAlign.Center; filterItem["MerchantPrincipal.Contact.LastName"].HorizontalAlign = HorizontalAlign.Center; filterItem["Business.HomePhone"].HorizontalAlign = HorizontalAlign.Center; filterItem["UnderwritingStatusDescription"].HorizontalAlign = HorizontalAlign.Center; filterItem["StatusDescription"].HorizontalAlign = HorizontalAlign.Center; } } catch (System.Exception ex) { _newLogic.WriteExceptionToDB(ex, "gridMerchantList_ItemDataBound"); } }