Varying number of nested Detail Grids. Is it possible?

4 posts, 0 answers
  1. Michael Hunt
    Michael Hunt avatar
    42 posts
    Member since:
    Aug 2009

    Posted 29 Oct 2009 Link to this post

    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.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. sahil
    sahil avatar
    35 posts
    Member since:
    Jul 2008

    Posted 17 Nov 2009 Link to this post

    -- 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!!!!!
  5. sahil
    sahil avatar
    35 posts
    Member since:
    Jul 2008

    Posted 17 Nov 2009 Link to this post

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

     

    }

    }

    }


Back to Top