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

RadGrid Heirarchy Master Detail - First row is always expanded

1 Answer 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 05 Jan 2017, 08:07 PM

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

1 Answer, 1 is accepted

Sort by
0
Keith
Top achievements
Rank 1
answered on 05 Jan 2017, 09:13 PM

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

Tags
Grid
Asked by
Keith
Top achievements
Rank 1
Answers by
Keith
Top achievements
Rank 1
Share this question
or