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

[Solved] How can I limit the expanded rows to just one

1 Answer 98 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Abhishek Gairola
Top achievements
Rank 1
Abhishek Gairola asked on 09 Nov 2010, 11:18 AM
I am using

GridViewToggleRowDetailsColumn


However I want that at a time only one row should be expanded.
If user tries to expand a second row the the event should be cancelled.
Once user has collapsed the row then he/she can expand another row.

Version 2009.3.1208.1030

Can anyone please help me with this functionality?

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 12 Nov 2010, 03:10 PM
Hello Abhishek Gairola,

You need to handle the RowDetailsVisibilityChanged event and ensure that the previously expanded row is collapsed, while the new one is expanded. For example:

GridViewRow expandedRow;      
private void clubsGrid_RowDetailsVisibilityChanged(object sender, Telerik.Windows.Controls.GridView.GridViewRowDetailsEventArgs e)
{
            if (e.Visibility == System.Windows.Visibility.Visible)
            {
                if (expandedRow != null)
                {
                    expandedRow.DetailsVisibility = System.Windows.Visibility.Collapsed;
                }
                expandedRow = e.Row;
            }
}
 

All the best,
Maya
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
GridView
Asked by
Abhishek Gairola
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or