小编Sco*_*ter的帖子

C#List Order By

我正在尝试为Razor Webgrid实现自定义排序.具体来说,我想排序一个没有出现在webgrid本身的列.

我想出去解决为什么ListOfMatching不会排序的问题.任何想法将不胜感激.

谢谢

        ResultsDisplayModel foo;        // MVVM class to be bound to the view
                                        // List of Matching is bound to a webgrid

//    public List<ResultsModel> ListOfMatching { get; set; }
//    TotalDebt is in a base class of ResultsModel called Expenses

        if (sort == "DebtBurden")
        {

            if (foo.bSortDirection)
            {
                foo.bSortDirection = false;
                foo.ListOfMatching.OrderByDescending(x => x.TotalDebt);
            }
            else
            {
                foo.bSortDirection = true;
                foo.ListOfMatching.OrderBy(x => x.TotalDebt);
            }
        }
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc-3

2
推荐指数
1
解决办法
1856
查看次数

标签 统计

asp.net-mvc-3 ×1

c# ×1