Completed
Last Updated: 17 Nov 2015 07:52 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 10 Nov 2015 13:11
Category: GridView
Type: Bug Report
1
FIX. RadGridView - ArgumentOutOfRangeException when changing the DataSource property
To reproduce:

1. Add a RadGridView and a RadButton.
2. Use the following code snippet:

Public Class Form1
    Private myList As New List(Of MyObject)
    Sub New()
        InitializeComponent()
        PopulateGrid(300)
    End Sub

    Private Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
        PopulateGrid(100) 
    End Sub

    Private Sub PopulateGrid(count As Integer)
        myList.Clear()
        Me.RadGridView1.DataSource = Nothing
        For index = 1 To count
            myList.Add(New MyObject(index, "Item" & index)) 
        Next
        Me.RadGridView1.DataSource = myList
    End Sub

    Public Class MyObject
        Public Sub New(ByVal myInt As Integer, ByVal myString As String)
            _myInt = myInt
            _myString = myString
        End Sub
        Private _myInt As Integer
        Public Property MyInt() As Integer
            Get
                Return _myInt
            End Get
            Set(ByVal value As Integer)
                _myInt = value
            End Set
        End Property
        Private _myString As String
        Public Property MyString() As String
            Get
                Return _myString
            End Get
            Set(ByVal value As String)
                _myString = value
            End Set
        End Property
    End Class
End Class

3. Select the last item
4. Click the button

Workaround: use BindingList instead of List
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments