protected void gvFlightLogs_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } if (e.Row.RowType == DataControlRowType.Footer) { int cCols = e.Row.Cells.Count; for (int i = cCols - 1; i >= 1; i--) { e.Row.Cells.RemoveAt(i); } e.Row.Cells[0].ColumnSpan = cCols; } else if (e.Row.RowType == DataControlRowType.DataRow) { LogbookEntryDisplay le = (LogbookEntryDisplay)e.Row.DataItem; SetUpContextMenuForRow(le, e.Row); SetUpBadgesForRow(le, e.Row); SetUpSelectionForRow(le, e.Row); SetUpImagesForRow(le, e.Row); SetStyleForRow(le, e.Row); if (colorQueryMap == null) { colorQueryMap = FlightColor.QueriesToColor(Pilot.UserName); } foreach (CannedQuery cq in colorQueryMap) { if (cq.MatchesFlight(le)) { e.Row.BackColor = FlightColor.TryParseColor(cq.ColorString); break; } } } }