protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         // Convert any keyword colors into cannedqueries.
         FlightColor.MigrateFlightColors(Page.User.Identity.Name);
         UpdateQueryList();
     }
 }
        protected void gvCanned_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                CannedQuery cq = (CannedQuery)e.Row.DataItem;

                if (!String.IsNullOrWhiteSpace(cq.ColorString))
                {
                    TextBox t = (TextBox)e.Row.FindControl("txtQsamp");
                    Label   l = (Label)e.Row.FindControl("lblQSamp");
                    t.Text      = cq.ColorString;
                    l.BackColor = FlightColor.TryParseColor(cq.ColorString);
                }
            }
        }
    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;
                }
            }
        }
    }