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

Expand child column by default

1 Answer 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul Khinvasara
Top achievements
Rank 1
Rahul Khinvasara asked on 25 Sep 2008, 05:13 AM
Hi,
        I am using rad grid. In that I have designed 3 level hierarchy.
Thus when I click on '+' sign of first level it expands. When I click on '+' sign of second level it expands.

Now my requirement is that I want this second level to be expanded by default without clicking on the '+' sign. Thus when I click on first level it should be expanded and it that I can see the third level in expanded format  be default.

Thanks,
Rahul
 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Sep 2008, 05:27 AM
Hi Rahul,

Try the following code snippet to achieve the desired scenario.

CS:
  protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            if (item.Expanded) 
            {  
                GridTableView childTableView=item.ChildItem.NestedTableViews[0]; 
 
                foreach (GridDataItem childitem in childTableView.Items) 
                { 
                    childitem.Expanded = true
                } 
            } 
        } 
    } 


Hope this helps..
Shinu.
Tags
Grid
Asked by
Rahul Khinvasara
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or