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
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