Completed
Last Updated: 13 Jun 2014 17:00 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 21 Feb 2014 13:19
Category: GridView
Type: Bug Report
1
FIX. RadGridView - Performance issue when sorting by GridViewComboBoxColumn with enabled DisplayMemberSort property
To reproduce:

Sub New()
    InitializeComponent()

    Dim dt As New DataTable()

    For index = 1 To 13
        If index = 4 Then
            dt.Columns.Add("Col" & index, Type.GetType("System.Int32"))
        Else
            dt.Columns.Add("Col" & index)
        End If

    Next

    Dim rand As New Random
    For index = 1 To 9000
        Dim newRow As DataRow = dt.NewRow()
        For Each col As DataColumn In dt.Columns
            If col.ColumnName = "Col4" Then
                newRow(col.ColumnName) = rand.Next(2, 1000).ToString()
            Else
                newRow(col.ColumnName) = "Data" & index.ToString() & "." & dt.Columns.IndexOf(col).ToString()
            End If


        Next

        dt.Rows.Add(newRow)
    Next

    Me.RadGridView1.DataSource = dt

    Me.RadGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill

    Me.RadGridView1.Columns.RemoveAt(3)

    Dim list As New List(Of CustomerMaster)
    For index = 1 To 1000
        list.Add(New CustomerMaster((index + 1), "Name" & (1000 - index + 1).ToString()))
    Next


    Dim CustomerMaster_IDColumn As GridViewComboBoxColumn = New GridViewComboBoxColumn
        With CustomerMaster_IDColumn
        .Name = "CustomerMaster_ID"
        .HeaderText = "Customer Master"
        .DataSource = list
        .ValueMember = "Id"
        .DisplayMember = "Name"
        .FieldName = "Col4"
        .Width = 200
        .DisplayMemberSort = True
        .DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList
    End With

    Me.RadGridView1.Columns.Insert(3, CustomerMaster_IDColumn)

End Sub

Public Class CustomerMaster
    Private _id As String
    Private _name As String

    Public Sub New(id As String, name As String)
        Me._id = id
        Me._name = name
    End Sub

    Public Property Id() As String
        Get
            Return _id
        End Get
        Set(ByVal value As String)
            _id = value
        End Set
    End Property

    Public Property Name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property

End Class

0 comments