Parent and child girds

6 posts, 0 answers
  1. stevied
    stevied avatar
    37 posts
    Member since:
    Apr 2007

    Posted 31 Mar 2011 Link to this post

    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..
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 31 Mar 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. stevied
    stevied avatar
    37 posts
    Member since:
    Apr 2007

    Posted 31 Mar 2011 Link to this post

    Thanks for the reply I am using Master/Detail Grids as demo'd here, does the same still apply?

    Regards,
  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 31 Mar 2011 Link to this post

    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
  6. stevied
    stevied avatar
    37 posts
    Member since:
    Apr 2007

    Posted 31 Mar 2011 Link to this post

    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.
  7. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 05 Apr 2011 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017