This is a migrated thread and some comments may be shown as answers.

[Solved] Specified argument was out of the range of valid values

1 Answer 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dany V
Top achievements
Rank 1
Dany V asked on 09 Nov 2009, 11:34 PM
Hi, I'm having a problem with a Grid, the thing is that I automatically expand the items and save the expand state when an update is done...but sometimes brings me this error:
Specified argument was out of the range of valid values.
Parameter name: ItemHierachicalIndex
I got the code to keep the state of the grid, from a telerik forum; this is where the page marks me the error

 

Protected Sub RadGrid1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.DataBound

 

 

'Expand all items using our custom storage

 

 

Dim indexes As String() = New String(Me.ExpandedStates.Keys.Count) {}

 

 

Me.ExpandedStates.Keys.CopyTo(indexes, 0)

 

 

Dim arr As New ArrayList(indexes)

 

 

'Sort so we can guarantee that a parent item is expanded before any of

 

 

'its children

 

arr.Sort()

 

For Each key As String In arr

 

 

If key Is Nothing Then

 

 

Else

 

 

Dim value As Boolean = DirectCast(Me.ExpandedStates(key), Boolean)

 

 

If value Then

 

------------------------>>>>>> RadGrid1.Items(key).Expanded =

True  <<<<<<<---------------------

 

 

End If

 

 

End If

 

 

Next

 

 

End Sub

 

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 12 Nov 2009, 04:58 PM
Hello Daniel,

I tried to reproduce the issue using the project from here for testing purposes but unfortunately to no avail. Can you please specify the steps that lead to the exception you describe? Thus I will do my best to advice you accordingly.
 
Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Dany V
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or