【问题标题】:Show a huge number of data in DevExpress GridView在 DevExpress GridView 中显示大量数据
【发布时间】:2014-04-22 21:03:31
【问题描述】:

我有一个包含 3000 行的 DevExpress 网格视图,每行有 10 个作为细节(这意味着当网格加载时我有 30000 个项目要加载)

加载所有数据需要很长时间,所以有什么方法可以显示例如 100 行,当用户使用自动过滤器时,我会显示所需的行?

示例 http://demos.devexpress.com/aspxgridviewdemos/filtering/filterrow.aspx

我尝试使用 Skip and Take(使用 LINQ),但这并不是我真正想要的,此外我还想使用网格的自动过滤器。

public static BindingList<patient> getObjectUsingLinq(string sql = "", int skipCount  = 0, int takeCount = 0)
        {
            var gsData = GetDataContext();
            var query = (from q in gsData.patient 
                        orderby q.nom 
                        select q);

            return new BindingList<patient>(LinqHelper.DoSortPaginate(query, "", skipCount, takeCount).ToList());

        }

并将其绑定到我调用的网格

listPatient = Patients.getObjectUsingLinq();
myGrid.DataSource = listPatient ;

【问题讨论】:

  • 在我们查看之前向我们展示您的代码。如果只有3000行应该很快
  • DoSortPaginate 的实现看起来如何,速度慢时使用的takeCount 是什么?

标签: c# devexpress gridcontrol


【解决方案1】:

如果您需要在 GridControl 中显示大量记录,您可以使用服务器数据绑定模式(同步或asynchronous)。这些专为处理包含 50,000 多条记录的大型数据集而设计。
查看Server Mode concepts 以了解这些模式。
使用 XtraGrid 和 LINQ,您可以从这里开始:
Server Mode: Binding to a Data Source Using 'LINQ to SQL Classes'

附: Data Source Configuration Wizard 简化了将数据感知 DevExpress 控件(如 GridControl)绑定到数据源的过程

【讨论】:

    猜你喜欢
    • 2017-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多