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

RadGrid for ASP.NET NestedView How To Stop multiple views?

2 Answers 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed Paay
Top achievements
Rank 1
Ed Paay asked on 01 Apr 2010, 10:43 PM
I have successfully created a grid in asp.net with a nested view.  Since I am new to radgrid I am wondering what is the best way to cause a currently displayed nested view to close before a new one is opened when the user clicks on a different parent row drop down button?  I only want one nested view to be open at the time.

Thanks ed.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Apr 2010, 11:35 AM

Hi Ed Paay,

Add the following code snippet in ItemCommand in order to allow single row expand at a time for each level in the grid hierarchy.

C#:

 
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
    {  
        if (e.CommandName == RadGrid.ExpandCollapseCommandName)  
        {  
            foreach (GridItem item in e.Item.OwnerTableView.Items)  
            {  
                if (item.Expanded && item != e.Item)  
                {  
                    item.Expanded = false;  
                }  
            }  
        }  
    } 

-Shinu.

0
Nishanth
Top achievements
Rank 1
answered on 02 Jun 2011, 11:28 PM
Is there a better way to do this now like assigning a property or something so that this occurs with out a postback?
Tags
Grid
Asked by
Ed Paay
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Nishanth
Top achievements
Rank 1
Share this question
or