Expand child column by default

2 posts, 0 answers
  1. Rahul Khinvasara
    Rahul Khinvasara avatar
    303 posts
    Member since:
    Aug 2007

    Posted 25 Sep 2008 Link to this post

    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
     
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Sep 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top