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

RadGrid Self-referencing Hierarchy Implementation Issue

5 Answers 122 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joy
Top achievements
Rank 2
Joy asked on 13 Dec 2010, 02:35 PM

We are trying to implement the self referencing hierarchy in RadGrid. But the example provided in the Telerik demo site creates expand\collapse button explicitly for each row of the GridDataItem.  Besides , It hide\expand the columns through iterating the each GridNestedViewItem and their nested tables recursively. Is there any other way to implement this functionality without creating explicit button control and avoiding the recursive loop for each GridDataItem?

5 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 14 Dec 2010, 04:57 PM
Hello Joy,

Our system indicates that you have opened a support ticket concerning the same issue.
In order to avoid duplicate posts, I suggest that we continue the communication in the support ticket.

Regards,
Mira
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Michelle Chen
Top achievements
Rank 1
answered on 07 Feb 2011, 09:00 PM
I am co-ask this question. Is there any solution?
0
Michelle Chen
Top achievements
Rank 1
answered on 07 Feb 2011, 09:10 PM
I have another question:
I am also using  'RadGrid Self-referencing Hierarchy'. What I need is: for the first time the page is load, I only want to expand the grid up to 3 levels, and leave the deeper levels collapse. How should I implement this?
Thanks 
0
Princy
Top achievements
Rank 2
answered on 08 Feb 2011, 11:45 AM
Hello Michelle,

Give a try with the following code snippet to achieve this.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
       if (!IsPostBack)
        {
            foreach (GridDataItem item in RadGrid1.Items)
            {
                item.Expanded = true;
                GridTableView childtableView = (GridTableView)item.ChildItem.NestedTableViews[0];
                foreach (GridDataItem childitem in childtableView.Items)
                {
                    childitem.Expanded = true;
                    GridTableView grandChildtableView = (GridTableView)childitem.ChildItem.NestedTableViews[0];
                    foreach (GridDataItem grandchilditem in grandChildtableView.Items)
                    {
                        grandchilditem.Expanded = true;
                    }
                }
            }
        }
    }

Thanks,
Princy.
0
Michelle Chen
Top achievements
Rank 1
answered on 08 Feb 2011, 06:28 PM
 Thanks Princy. It works.
Tags
Grid
Asked by
Joy
Top achievements
Rank 2
Answers by
Mira
Telerik team
Michelle Chen
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or