RadGrid. Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

Thread is closed for posting
2 posts, 0 answers
  1. Bogdan
    Bogdan avatar
    1 posts
    Member since:
    Jan 2013

    Posted 30 Jan 2013 Link to this post

    When I click on  btnAssignId, grdResult has 4 rows, but in debug mode in loop I see 5 iterations and on 5th Exeption throw
    at line where I try GetDataKeyValue

    Private Sub btnAssignId_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAssignExistingId.Click
      If Not String.IsNullOrEmpty(tbMatlID.SelectedValue) Then
        For Each item As GridItem In grdResult.Items
          If item IsNot Nothing Then
            Dim griddata = CType(item, GridDataItem)
       Dim resultId griddata.GetDataKeyValue("ResultId")
            Update(resultId, tbMatlID.SelectedValue)
          End If 
      End If
    End Sub
  2. Eyup
    Eyup avatar
    3320 posts

    Posted 04 Feb 2013 Link to this post

    Hello Bogdan,

    I have created a sample RadGrid web site to test the described behavior. On my side everything works as expected and the the items collection returns the correct count. Please check out the attached application and let me know about the result.

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top