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

Varying number of nested Detail Grids. Is it possible?

3 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael Hunt
Top achievements
Rank 1
Michael Hunt asked on 29 Oct 2009, 04:19 PM
HI,

I am using 2008.3.1105.35 of the asp.net ajax controls.

I want to know if the Grid control can be created in such a way as to display any number of nested "child" or detail tables.  I need to represent a parent - child relationship where the children can have children, which can have children, and on and on. 

I also need to be able to insert / edit / delete another child table at any level in the grid.
An example will give you a clearer picture of what I want to do.  Here is an example of how my data might look:

-- ParentGroup1
      ChildGroup1
          Task1
          Task2
--ParentGroup2
       Task1
       ChildGroup1
             Task2
             ChildGroup2
                   ChildGroup3
                          Task1
--ParentGroup3
       ChildGroup1
         .....
             ChildGroupN
                   Task1

Users can add ChildGroups to ParentGroups or to other ChildGroups, at any level.  There is no restriction on the levels of groups.

I've seen the Self Referencing Hierarchy grid example below, but I don't see how that would be a solution to my problem. 
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/selfreferencing/defaultcs.aspx

Q.  Can I use the Telerik grid to accomplish this?

If so, would I need to do it all programatically?  Like, by adding detail tables on the fly?

Thanks In Advance.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Oct 2009, 07:21 AM
0
sahil
Top achievements
Rank 1
answered on 17 Nov 2009, 12:25 PM
-- ParentGroup1
      ChildGroup1
          Task1
          Task2
--ParentGroup2
       Task1
       ChildGroup1
             Task2
             ChildGroup2
                   ChildGroup3
                          Task1
--ParentGroup3
       ChildGroup1
         .....
             ChildGroupN
                   Task1
====================================================================================
Can You Please Provide me demo regarding this topic.( Multiple Infinite hierarchy in Radgrid )

I want this type of functionality in my project.

but working from last 3 days . i have not find any good solution.

Please Help!!!!!
0
sahil
Top achievements
Rank 1
answered on 18 Nov 2009, 04:10 AM
Question:How this code work as multiple infinite hierarchy::;?????? Please provide demo of this code:

protected void RadGridProducts_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

 

{

 

if (!e.IsFromDetailTable)

 

{

 

int dbId = (int)HttpContext.Current.Session["INSTR_ID"];

 

 

List<InstrProduct> products = _presenter.PopulateProductsData(dbId, 0, 30);

 

 

RadGrid grid = (RadGrid)source;

 

grid.DataSource = products;

}

}

 

 

protected

 

void RadGridProducts_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)

 

{

 

GridDataItem parentItem = e.DetailTableView.ParentItem;

 

 

int productId = Convert.ToInt32(parentItem.GetDataKeyValue("Id"));

 

 

string[] datakeyNames = { "Id","ParentId","ProductLevel","Tag" };

 

e.DetailTableView.DataKeyNames = datakeyNames;

 

GridRelationFields relationFields = new GridRelationFields

 

 

 

 

{

MasterKeyField =

"Id",

 

DetailKeyField =

"ParentId"

 

 

 

 

};

 

String htmlColor = "#6699CC";

 

 

//Color backColor = ColorTranslator.FromHtml(htmlColor);

 

 

 

 

 

//e.DetailTableView.HeaderStyle.BackColor = backColor;

 

 

 

 

e.DetailTableView.ParentTableRelation.Add(relationFields);

e.DetailTableView.Width =

Unit.Percentage(100);

 

e.DetailTableView.DataSource = _presenter.GetChildProducts(productId);

 

}

 

 

protected void RadGridProducts_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

if (e.Item is GridDataItem && !(e.Item is GridDataInsertItem))

 

{

 

int productCnt = Convert.ToInt32(((InstrProduct)e.Item.DataItem).ProductChildCount);

 

 

if (productCnt == 0)

 

{

e.Item.Cells[0].Controls[0].Visible =

false;

 

 

//Added to help empty cell render correctly

 

 

 

 

e.Item.Cells[0].Text =

"&nbsp;";

 

}

}

}


Tags
Grid
Asked by
Michael Hunt
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
sahil
Top achievements
Rank 1
Share this question
or