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

Parent and child girds

5 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
stevied
Top achievements
Rank 2
stevied asked on 31 Mar 2011, 12:16 PM
I have a Parent RadGrid, you can click on the Rows and the child rad grid will appear. You can then go and add items to the child grid, once a new item is inserted I need to rebind the parent grid but still maintain the originally selected row.

I have the folllowing code, it rebinds the parent gird but i lose my selected row.

Protected Sub rgRiskAssessmentItems_ItemInserted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) Handles rgRiskAssessmentItems.ItemInserted
        If Not e.Exception Is Nothing Then
            e.ExceptionHandled = True
            e.KeepInInsertMode = True
            SetMessage("Risk Assessment Item cannot be inserted. Reason: " + e.Exception.Message)
        Else
            SetMessage("New Risk Assessment Item has been added!")
            'Make sure we get a submit button in the top grid after adding an item to the lower grid
            rgRiskAssessment.Rebind()
            'rgRiskAssessmentItems.Rebind()
 
        End If
 
    End Sub

Thanks for reading..

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 31 Mar 2011, 12:55 PM
Hi,

Please refer to the following code library which demonstrates how you can persist selected state in hierarchy on rebind:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/retain-expanded-selected-state-in-hierarchy-on-rebind.aspx

Kind regards,
Pavlina
the Telerik team
0
stevied
Top achievements
Rank 2
answered on 31 Mar 2011, 02:20 PM
Thanks for the reply I am using Master/Detail Grids as demo'd here, does the same still apply?

Regards,
0
Pavlina
Telerik team
answered on 31 Mar 2011, 02:45 PM
Hi,

In this case to preserve the selected rows you can try using the approach provided in the following help article:
http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-on-sorting.html

Best wishes,
Pavlina
the Telerik team
0
stevied
Top achievements
Rank 2
answered on 31 Mar 2011, 03:21 PM
thanks Pavlina,  unfortunately I am using row clicks for my Master grid...

<clientsettings allowkeyboardnavigation="true" enablepostbackonrowclick="true"  >
                <Selecting AllowRowSelect="true" />
            </clientsettings>

and i see from your link it says...

"This example only works if you have not enabled client-side selection (that is, you are selecting rows using Command buttons)."

Is there a way round this?

Many thanks.
0
Pavlina
Telerik team
answered on 05 Apr 2011, 03:39 PM
Hi,

More information about how to persist the selected rows client-side is available here:
http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-client-sorting-paging-grouping-filtering.html

Kind regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
stevied
Top achievements
Rank 2
Answers by
Pavlina
Telerik team
stevied
Top achievements
Rank 2
Share this question
or