I have a rad grid view with hierarchical template. User can expand each row, and in normal mode User can expand several rows. I need to prevent such behavior and let user to only expand one row at a time.
I searched in telerik forums and Google but did not find any helpful code working on winforms radgridview.
Use radGridView's ChildViewExpanded event
and a variable to store the last expanded row index
int lastExpandedRow = -1;
private void radGridView_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e)
{
int parentRowIndex = e.ParentRow.Index;
if (lastExpandedRow != -1 && lastExpandedRow != parentRowIndex )
{
radGridView.Rows[lastExpandedRow].IsExpanded = false;
}
lastExpandedRow = parentRowIndex ;
}