Completed
Last Updated: 09 Nov 2016 13:51 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 17 Oct 2016 10:26
Category: GridView
Type: Bug Report
1
FIX. RadGridView - slow selection when multiple cells are selected programmatically
To reproduce:

Sub New()

    InitializeComponent()

    Dim dt As New DataTable
    dt.Columns.Add("Id", GetType(Integer))
    dt.Columns.Add("Name", GetType(String))

    For index = 1 To 200000
        dt.Rows.Add(index, "Item" & index)
    Next
    Me.RadGridView1.DataSource = dt

    Me.RadGridView1.MultiSelect = True
    Me.RadGridView1.SelectionMode = Telerik.WinControls.UI.GridViewSelectionMode.CellSelect
End Sub

Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
    Dim sw As New Stopwatch
    sw.Start()

    Dim mi As MethodInfo = GetType(GridViewSelectedCellsCollection).GetMethod("BeginUpdate", BindingFlags.Instance Or BindingFlags.NonPublic)
    mi.Invoke(Me.RadGridView1.MasterTemplate.SelectedCells, Nothing)
    For Each row As GridViewDataRowInfo In Me.RadGridView1.Rows
        row.Cells("Name").IsSelected = True
    Next
    
    Dim mi2 As MethodInfo = GetType(GridViewSelectedCellsCollection).GetMethod("EndUpdate", BindingFlags.Instance Or BindingFlags.NonPublic)
    mi2.Invoke(Me.RadGridView1.MasterTemplate.SelectedCells, New Object() {True})

    sw.Stop()
    RadMessageBox.Show(sw.ElapsedMilliseconds)
End Sub
0 comments