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

Auto Collapse Details on Expand?

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MFitzpatrick
Top achievements
Rank 1
MFitzpatrick asked on 30 Jul 2010, 04:33 PM
Hello-

I am using a radgrid with a nested details grid. I am trying to do something that would seem rather simple. When the user clicks the expand button on a row  with details, any other row's expanded details will collapse. I have tried to collapse all rows in the itemCommand event, but have had no success. Here is my item command event:

Protected Sub grdAvailability_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grdAvailability.ItemCommand

        If e.CommandName = "ExpandCollapse" Then

            Dim parentGrid = CType(source, RadGrid)

            For Each item As GridDataItem In parentGrid.Items

                item.Expanded = False

            Next

            grdAvailability.Items(e.Item.ItemIndex).Selected = True

        End If

    End Sub

This does not work. When I expand a new row, the details of the previous row are still expanded. Any Ideas on how this can be achieved?

Thanks

1 Answer, 1 is accepted

Sort by
0
MFitzpatrick
Top achievements
Rank 1
answered on 30 Jul 2010, 06:21 PM
Tags
Grid
Asked by
MFitzpatrick
Top achievements
Rank 1
Answers by
MFitzpatrick
Top achievements
Rank 1
Share this question
or