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

Failed to load viewstate. The control tree into which...

3 Answers 820 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rajneesh
Top achievements
Rank 2
Rajneesh asked on 21 Dec 2011, 01:37 PM
Hi,
I am facing issue when trying to edit or delete a row of rad grid-view. I have one RadPageView and inside this i am loading a User Control and in user control i have a RadGrid. Till now its working fine but it throws error when someone (By mistake) trying to edit a row and same time click edit for other row of next item after this if i click update/cancel or any other location it throws error as below:

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

So i want only one edit option should be enable at once. if so then error will not come. For more information i have attached a screenshot. If you have still any doubt please let me know...

Thanks...

3 Answers, 1 is accepted

Sort by
0
Rajneesh
Top achievements
Rank 2
answered on 22 Dec 2011, 08:19 AM
Hi,
Still working and unable to find any solution. now i did as:
Protected Sub radGridEngMemberAccess_EditCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles radGridEngMemberAccess.EditCommand
       Dim _itemName As String = e.Item.UniqueID
        
       Dim nestedViewItems As GridItem() = radGridEngMemberAccess.MasterTableView.GetItems(GridItemType.NestedView)
       For Each nestedViewItem As GridNestedViewItem In nestedViewItems
           For Each nestedView As GridTableView In nestedViewItem.NestedTableViews
               For Each Data As GridDataItem In nestedView.Items
                   If String.Equals(Data.UniqueID, _itemName) Then
                       If Not String.Equals(Data.Edit, True) Then
                           Data.Edit = False
                       End If
                   Else
                       Data.Edit = False
                   End If
                    
               Next              
           Next
       Next
   End Sub

But when i click on edit button of next nested grid and looping then previous row state shows edit = false. so its still in edit mode and error remains same as 2 rows of different grid are in edit mode.

Waiting for reply.......
0
Marin
Telerik team
answered on 27 Dec 2011, 09:27 AM
Hello Rajneesh,

You can try setting the AllowMultiRowEdit property of the RadGrid  to "false". This way only one row should remain in edit mode at a time.

All the best,
Marin
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
0
Rajneesh
Top achievements
Rank 2
answered on 23 Jan 2012, 07:14 AM
I tried but nothing change.
:(
Tags
Grid
Asked by
Rajneesh
Top achievements
Rank 2
Answers by
Rajneesh
Top achievements
Rank 2
Marin
Telerik team
Share this question
or