Пример #1
0
    protected void gvFlightLogs_Sorting(Object sender, GridViewSortEventArgs e)
    {
        if (sender == null)
        {
            throw new ArgumentNullException("sender");
        }
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }

        GridView gv = (GridView)sender;
        List <LogbookEntryDisplay> lst = (List <LogbookEntryDisplay>)gv.DataSource;

        if (lst != null)
        {
            if (HasPrevSort)
            {
                string        PrevSortExpr = LastSortExpr;
                SortDirection PrevSortDir  = LastSortDir;

                if (PrevSortExpr == e.SortExpression)
                {
                    e.SortDirection = (PrevSortDir == SortDirection.Ascending) ? SortDirection.Descending : SortDirection.Ascending;
                }
            }

            LastSortExpr = e.SortExpression;
            LastSortDir  = e.SortDirection;

            LogbookEntryDisplay.SortLogbook(lst, LastSortExpr, LastSortDir);
            BindData();
        }
    }
Пример #2
0
    protected void SortGridview(GridView gv, List <LogbookEntryDisplay> lst)
    {
        if (!String.IsNullOrEmpty(LastSortExpr))
        {
            foreach (DataControlField dcf in gv.Columns)
            {
                dcf.HeaderStyle.CssClass = "headerBase" + ((dcf.SortExpression.CompareCurrentCultureIgnoreCase(LastSortExpr) == 0) ? (LastSortDir == SortDirection.Ascending ? " headerSortAsc" : " headerSortDesc") : string.Empty);
            }
        }

        LogbookEntryDisplay.SortLogbook(lst, LastSortExpr, LastSortDir);
        BindData(lst);
    }
    protected void SortGridview(GridView gv, List <LogbookEntryDisplay> lst)
    {
        if (!String.IsNullOrEmpty(LastSortExpr))
        {
            if (gv == null)
            {
                throw new ArgumentNullException(nameof(gv));
            }
            foreach (DataControlField dcf in gv.Columns)
            {
                dcf.HeaderStyle.CssClass = "headerBase" + ((dcf.SortExpression.CompareCurrentCultureIgnoreCase(LastSortExpr) == 0) ? (LastSortDir == SortDirection.Ascending ? " headerSortAsc" : " headerSortDesc") : string.Empty) + (dcf.SortExpression.CompareCurrentCultureIgnoreCase("Date") == 0 ? " gvhLeft" : " gvhCentered");
            }
        }

        LogbookEntryDisplay.SortLogbook(lst, LastSortExpr, LastSortDir);
        BindData(lst);
    }
Пример #4
0
    protected void gvFlightLogs_Sorting(Object sender, GridViewSortEventArgs e)
    {
        if (sender == null)
        {
            throw new ArgumentNullException("sender");
        }
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }

        GridView gv = (GridView)sender;
        List <LogbookEntryDisplay> lst = (List <LogbookEntryDisplay>)gv.DataSource;

        if (lst != null)
        {
            if (HasPrevSort)
            {
                string        PrevSortExpr = LastSortExpr;
                SortDirection PrevSortDir  = LastSortDir;

                if (PrevSortExpr == e.SortExpression)
                {
                    e.SortDirection = (PrevSortDir == SortDirection.Ascending) ? SortDirection.Descending : SortDirection.Ascending;
                }
            }

            LastSortExpr = e.SortExpression;
            LastSortDir  = e.SortDirection;

            foreach (DataControlField dcf in gv.Columns)
            {
                dcf.HeaderStyle.CssClass = "headerBase" + ((dcf.SortExpression.CompareCurrentCultureIgnoreCase(e.SortExpression) == 0) ? (e.SortDirection == SortDirection.Ascending ? " headerSortAsc" : " headerSortDesc") : string.Empty);
            }

            LogbookEntryDisplay.SortLogbook(lst, LastSortExpr, LastSortDir);
            BindData();
        }
    }