Telerik RadGrid在Winforms中的性能太慢

时间:2016-10-06 10:34:47

标签: vb.net winforms telerik

我在Rad grid win表格中加载了超过50000条记录。如何优化并使网格快速加载(即时)?是否可以选择在telerik rad网格列过滤器中加载逐页过滤器?。

 Me.cncFilesGridRad.MasterTemplate.AllowAddNewRow = False
            Me.cncFilesGridRad.MasterTemplate.AllowDeleteRow = False
            Me.cncFilesGridRad.MasterTemplate.ShowRowHeaderColumn = False
            Me.cncFilesGridRad.MasterTemplate.ShowHeaderCellButtons = False
            Me.cncFilesGridRad.UseScrollbarsInHierarchy = True
            Me.cncFilesGridRad.ShowGroupPanel = False
            Me.cncFilesGridRad.HorizontalScroll.Enabled = True
            Me.cncFilesGridRad.MasterTemplate.EnableSorting = True
            Me.cncFilesGridRad.MasterTemplate.EnableGrouping = False
            Me.cncFilesGridRad.EnableFiltering = True
            Me.cncFilesGridRad.ShowHeaderCellButtons = True

            Me.cncFilesGridRad.MasterTemplate.EnableFiltering = True
            Me.cncFilesGridRad.ShowFilteringRow = False
            Me.cncFilesGridRad.MasterTemplate.ShowFilterCellOperatorText = False
            Me.cncFilesGridRad.MasterTemplate.AllowCellContextMenu = False
            Me.cncFilesGridRad.EnableFastScrolling = True
            Me.cncFilesGridRad.BeginUpdate()
            Me.cncFilesGridRad.DataSource = GlobalVariables.CNCFilesCollection

            Me.cncFilesGridRad.AutoSizeRows = True

            Me.cncFilesGridRad.TableElement.RowHeight = 60
            Me.cncFilesGridRad.TableElement.FilterRowHeight = 40
            Me.cncFilesGridRad.GridViewElement.PagingPanelElement.NumericButtonsCount = 25
            Me.cncFilesGridRad.VirtualMode = True

            AddTemplateToGrid()

            Me.cncFilesGridRad.MasterTemplate.Templates(0).AllowAddNewRow = False
            Me.cncFilesGridRad.MasterTemplate.Templates(0).AllowDeleteRow = False
            Me.cncFilesGridRad.MasterTemplate.Templates(0).AllowEditRow = False


            For Each col As GridViewDataColumn In Me.cncFilesGridRad.Columns
                col.IsVisible = False
            Next

            For Each col As GridViewDataColumn In Me.cncFilesGridRad.MasterTemplate.Templates(0).Columns
                col.IsVisible = False
            Next

            'child row column
            column = Me.cncFilesGridRad.MasterTemplate.Templates(0).Columns("Name")
            column.HeaderText = "Name"
            column.IsVisible = True
            column.ReadOnly = True

            'parent rows
            checkColumn = New GridViewCheckBoxColumn()
            checkColumn.DataType = GetType(Integer)
            checkColumn.HeaderText = "Select"
            checkColumn.Name = "Select"
            checkColumn.IsVisible = True
            checkColumn.EditMode = EditMode.OnValueChange
            checkColumn.Width = 83
            Me.cncFilesGridRad.MasterTemplate.Columns.Add(checkColumn)
            Me.cncFilesGridRad.Columns.Move(checkColumn.Index, 0)

            commandColumn = New GridViewCommandColumn()
            commandColumn.Name = "EditColumn"
            commandColumn.UseDefaultText = True
            commandColumn.DefaultText = "Edit"
            commandColumn.FieldName = "Edit"
            commandColumn.Width = 50
            commandColumn.TextAlignment = ContentAlignment.MiddleCenter
            Me.cncFilesGridRad.MasterTemplate.Columns.Add(commandColumn)
            Me.cncFilesGridRad.Columns.Move(commandColumn.Index, 1)    

            descriptor.PropertyName = "Name"
            Me.cncFilesGridRad.Columns("Name").SortOrder = RadSortOrder.Ascending
            Me.cncFilesGridRad.MasterTemplate.SortDescriptors.Add(descriptor)



            Me.cncFilesGridRad.MasterTemplate.Templates(0).AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill


            Me.cncFilesGridRad.CurrentRow = Nothing

            filterDescriptor.PropertyName = "Name"
            filterDescriptor.[Operator] = FilterOperator.StartsWith
            filterDescriptor.IsFilterEditor = True
            Me.cncFilesGridRad.Columns("Name").FilterDescriptor = filterDescriptor

如何在加载更多记录时提高rad网格性能?

2 个答案:

答案 0 :(得分:0)

在页面移动时加载记录,即一个页面可以有100个记录,当我们点击第二页时,它会有另一个100个记录... 将提高性能

答案 1 :(得分:0)

您应该关注的是分页功能。 Telerik的GridView控件自然支持此功能。

  

RadGridView的数据层现在支持原生数据分页。您仍然可以通过添加分页选项将RadGridView绑定到与之前相同的数据提供程序。有许多功能,可以让您轻松配置和管理数据分页。

有关分页如何工作的详细信息,请参阅以下链接。

http://docs.telerik.com/devtools/winforms/gridview/paging/overview#paging-overview

http://docs.telerik.com/devtools/winforms/gridview/paging/paging-panel

http://www.telerik.com/videos/winforms/radgridview-for-winforms-webinar