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

[Solved] Put All Grandchild rows into Edit Mode

2 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 19 Jan 2010, 08:52 PM
I have a hierarchial grid with 3 levels - Parent, Child, & Grandchild.  When the user clicks the imagebutton on a Child level row, I want all of the Grandchild level rows to go into edit mode.  Here's my code:

Protected Sub dg_ItemCommand(ByVal source As ObjectByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles dg.ItemCommand  
        If e.CommandName = "editChild" Then 
            If Not e.Item.Expanded Then 
                e.Item.Expanded = True 
            End If 
            Dim item As GridDataItem = CType(e.Item, GridDataItem)  
            Dim nestedTableView As GridTableView = CType(item.ChildItem.NestedTableViews(0), GridTableView)  
            For Each grandChild As GridDataItem In nestedTableView.Items  
                grandChild.Edit = True 
            Next 
            nestedTableView.Rebind() 

Upon Rebind(), I receive the following error:

"Specified argument was out of the range of valid values. Parameter name: index"

Before the Rebind, nestedTableView.Items.Count = 4.  After the Rebind, nestedTableView.Items.Count = 0.

If I rebind the grid instead of rebinding the tableview, ( dg.Rebind() ) then I lose all the Child & Grandchild data with no errors.  If I rebind on the event item itself ( item.OwnerTableView.Rebind() ) then I only lose the GrandChild data with no errors.

Needless to say, I'm pretty confused what object to do my rebind on in order to put all of the Grandchild rows into edit mode and retain the data visibly on the screen.  I'm guessing I'm pretty close.

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Rob
Top achievements
Rank 1
answered on 20 Jan 2010, 06:38 PM
I could definitely use an answer on this today in order to move forward on my project.

Thanks!
0
Princy
Top achievements
Rank 2
answered on 21 Jan 2010, 07:13 AM
Hello Dudeman,

You can go through the following forum link where you'd find a similar issue being discussed. Check out the suggestions provided there and see if it helps in your scenario:
Error Editing Row of Programmatically Populated Grid

Hope this helps..
Princy.
Tags
Grid
Asked by
Rob
Top achievements
Rank 1
Answers by
Rob
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or