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

[Solved] How to create GridTableView with programatically nested .

1 Answer 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DragonBall
Top achievements
Rank 1
DragonBall asked on 08 Sep 2009, 02:04 AM


i have to specify total number of nested GridTableView and create a detail table to each GridTableView created
depends on the input #of time nested


example input 5 nested GridTableView

output should be like this:
GridTableView 0
     GridTableView1
            GridTableView2
                GridTableView 3
                         GridTableView 4    

 public GridTableView CreateDetailTable(int i) 
    { 
 
            GridTableView table = new GridTableView(); 
            table.Name=string.Format("GridTableView{0}", i); 
         
         
        return table;  
    } 
 
    public GridTableView AddDetailTable(GridTableView view,int i) 
    { 
 
        view.DetailTables.Add(CreateDetailTable(i)); 
         
        foreach (GridTableView vw in view.DetailTables) 
        { 
            tableview = vw
        } 
        return tableview; 
    } 
 
    private void GenerateDetailTable(int count) 
    { 
 
        gtv = new GridTableView(); 
        GridTableView tempView = CreateDetailTable(0); 
        gtv.DetailTables.Add(tempView); 
        GridTableView Loop = gtv
        for (int i = 1; i < count; i++) 
        { 
            tempView=AddDetailTable(tempView, i); 
 
            foreach (GridTableView item in Loop.DetailTables) 
            { 
                item.DetailTables.Add(tempView); 
                Loop = item
            } 
        } 
    } 

example input 3 nested GridTableView

output should be like this:
GridTableView0
     GridTableView1
            GridTableView2

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 09 Sep 2009, 05:11 PM
Hello Manuel,

I built a sample project demonstrating one possible approach to the desired functionality.

If you need further assistance please don't hesitate to contact us again.

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
DragonBall
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or