RadGrid Heirarchy Master Detail - First row is always expanded

2 posts, 0 answers
  1. Keith
    Keith avatar
    117 posts
    Member since:
    Mar 2015

    Posted 05 Jan 2017 Link to this post

    I have a ASP.Net page with a RadGrid that has a Master and Detail Table views.  The code-behind is VB.Net.

    This is the first time I used the RadGrid with the Master and Detail Table views.

    I am using the NeedDataSource event to bind data to the RadGrid.

    Once I got it to work, I am finding that the first parent item on the first page is always being expanded.  I would like to configure the RadGrid so none of the parent items are being expanded.  How do I do that?

    Please help!

    Sincerely,

    Keith Jackson

  2. Keith
    Keith avatar
    117 posts
    Member since:
    Mar 2015

    Posted 05 Jan 2017 in reply to Keith Link to this post

    I found what was causing the first parent item to be expanded.

    I got the following from one Telerik's demos:

    Protected Sub rgTagChangeBuildups_PreRender(sender As Object, e As EventArgs) Handles rgTagChangeBuildups.PreRender
        Try
            If Not Page.IsPostBack Then
                rgTagChangeBuildups.MasterTableView.Items(0).Expanded = True
                rgTagChangeBuildups.MasterTableView.Items(0).ChildItem.NestedTableViews(0).Items(0).Expanded = True
            End If
     
        Catch ex As Exception
            strErrorMsg = "Procedure: rgTagChangeBuildups_PreRender - TagChangeBuildups" & vbCrLf & "Error Message: " & ex.Message & vbCrLf & "Source: " & ex.Source
            UserFunctions.UserMsgBox(Me, strErrorMsg)
     
        End Try
    End Sub

     

    Well, the Try-Catch is what I put in.  The rest of the PreRender code was from the demo.

    If I change the first line after the If statement to the following:

    rgTagChangeBuildups.MasterTableView.Items(0).Expanded = False

    Then it does not expand the first record.

    Thanks!

    Sincerely,

    Keith Jackson

Back to Top