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

Hierarchcal Grid Structure. Please review and comment

1 Answer 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Harpreet
Top achievements
Rank 1
Harpreet asked on 10 Jul 2008, 06:23 AM
Hello,

I am working on a hierarchical grid and each level uses a different data table.
I am aware of the fact that telerik has self-referencing hierarchical model of radGrid but somehow that doesn't solve my purpose.

I would like experts to review my design and comment upon the efficiency and improvement if needed.



    RadGrid RadGrid2 = new RadGrid();


  protected void Page_Load(object sender, EventArgs e)
{
       GenerateGrid(dtUserData);
}


  private void GenerateGrid(DataTable dtUserData)
    {
          //define RadGrid2 properties. Grid is dynamically generated on the server side and then thrown inside a placeholder right at the end.

RadGrid2.DataSource = myTable;

 RadGrid2.MasterTableView.DataKeyNames = new string[] { "Community", "Locality" };

        GridBoundColumn boundColumn;
        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "Community";   
        RadGrid2.MasterTableView.Columns.Add(boundColumn);

       //set Community as Groupby Expression for the grid

      // now define the first child table of the master table as follows

        GridTableView tableViewDS = new GridTableView(RadGrid2);

        tableViewDS.Name = "tableViewDS";
        tableViewDS.DataSource = myTable1;

        tableViewDS.Width = Unit.Percentage(100);

        tableViewDS.DataKeyNames = new string[] { "Community", "Locality", "Authority" };

          // Set relations between the parent and the child here

        // make a child tableview of tableViewDS now in the same manner tableViewDS is created.

}

**************************************************
****************************************************

Now the problem is that the whole grid is created on each post back.

There is something called
RadGrid2.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
But this won't fetch values for my data tables on post back. Datatable values are available at the server side only I guess. Don't know how to do the whole thing on client side.
I have 5 such levels in my grid i.e one single hierarchy runs down from level 1 to 5.

Is there any way to make my code efficient.

Also, is there a way to create each level dynamically on ItemDatabound or something.

Please suggest how should I improve my hierarchical grid.

Thanks and regards,
Harpreet
       



1 Answer, 1 is accepted

Sort by
0
Baatezu
Top achievements
Rank 2
answered on 10 Jul 2008, 11:21 AM
I wrote up a small thing for someone else about hierarchy in grids - http://www.telerik.com/community/forums/thread/b311D-begamh.aspx
Hopefully that will help point you in the correct direction.
The main things you will want to pay attention to is the NeedDataSource and DetailTableDataBind.
I hope that helps.
Tags
Grid
Asked by
Harpreet
Top achievements
Rank 1
Answers by
Baatezu
Top achievements
Rank 2
Share this question
or