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

[Solved] Client Side RowClick - Index outside the bounds of the array

2 Answers 256 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reuven
Top achievements
Rank 1
Reuven asked on 16 Mar 2010, 01:48 PM
Have no idea what it would take to reproduce this, but basically had a grid that had the rowclick event working until I manipulated a details table on prerender significantly (hide it for example if there is no data). Now when I click on a item on the mastertable, I get a:

Error: Sys.WebForms.PageRequestManagerServerErrorException: Index was outside the bounds of the array.

The eventArgs.get_itemIndexHierarchical is set to the correct row, the mastertableview has the correct number of "get_dataItems()".

Please let me know what I can send to help clarify the problem.

Thanks,
Reuven

2 Answers, 1 is accepted

Sort by
0
Reuven
Top achievements
Rank 1
answered on 17 Mar 2010, 10:03 AM

I've been able to narrow it down to a problem simply accessing GetItems in PreRender

        Protected Sub RadGridSpecialtyProblemList_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles RadGridSpecialtyProblemList.PreRender  
            For Each item As GridDataItem In RadGridSpecialtyProblemList.MasterTableView.Items  
                If item.HasChildItems Then 
                    Dim nestedtable As GridTableView = item.ChildItem.NestedTableViews(0)  
               ===> Dim footer As GridItem = DirectCast(item.ChildItem.NestedTableViews(0).GetItems(GridItemType.Footer)(0), GridFooterItem)  
                    Dim ddlStudies As DropDownList = DirectCast(item.ChildItem.NestedTableViews(0).GetItems(GridItemType.Footer)(0).FindControl("ddlStudies"), DropDownList)  
                    If nestedtable.Items.Count = 0 And ddlStudies.Items.Count = 0 Then 
                        nestedtable.visible = False 
                    Else 
                        If ddlStudies.Items.Count = 0 Then footer.visible = False 
                    End If 
                End If 
            Next 
        End Sub 
 
Basically have a DetailTable that shows "enrolled" studies for a particular problem (item in my mastertable). The footer on the Detailstable has a dropdownlist that is bound to the available studies (if a study is enrolled, then it does not show up on the ddl). So if there are no studies at all, I want to hide the detailstable completely. If there are no enrolled studies, but some available, I display the NoRecordsText, and show the footer. If there are enrolled studies, but none available remaining, then I want to hide the DetailTableFooter. The above code works perfectly, except that subsequent operations give an Index outside the bounds of the array error.

Thanks,
Reuven
0
Reuven
Top achievements
Rank 1
answered on 17 Mar 2010, 11:06 AM
figured out my problem - didn't have to wait until PreRender to do this, but could just set everything on ItemDataBound. Conceptually, was missing that this event gets raised for all subitems in the grid, so just needed to check for the ownertableview.name and the itemtype and was set.
Tags
Grid
Asked by
Reuven
Top achievements
Rank 1
Answers by
Reuven
Top achievements
Rank 1
Share this question
or