Child node in Datagrid


  • I have to display my Data in datagrid something in child -parent form:

     S.NO    Name    Gender    Age

      1       ABC          M         45

      1.1    def             F         21

      1.1.1  hjg           M          7

      1.1.2  hjgh         F           12

      1.2    ijjk            F            23

    which should collapse and expand.  Can anyone give me some solution, Please help, its urgent, asap.

    Monday, April 05, 2010 5:09 AM


All replies

  •  No i do'nt want  group format. It should be editable at all levels.

    Monday, April 05, 2010 6:44 AM
  • What I feel is you can add and remove rows based on expand collase images click events which you can place in the first column of the Datagrid. Keep one global list which will have the complete list and then you can have a copy of that list from where you can add and remove rows.


    Monday, April 05, 2010 7:17 AM
  •  Hi Varsha,

    Can i get ur email-id so that i can send you the prototype, which will clearly explain u my problem, if you dont mind.


    Monday, April 05, 2010 8:56 AM
  • Yes, why not... its

    Monday, April 05, 2010 9:00 AM
  •  You can set <RowDetailsTemplate/> to display the child data. You can have nested DataGrid in the Detail section.

    Monday, April 05, 2010 10:27 AM
  • Using <RowDetailsTemplate/> wont solve my problem. Is there any other solution

    Tuesday, April 06, 2010 1:56 AM
  •  Hi Varsha,

    I am facing probelm in following Section when merged ur code with my module. Can u tell me what is the problem.

     private void AddRowsToGrid(List<ServiceRef.CategoryTabGridData> lstResult, string strNewNodesToOpen)
                    List<int> lstShow = GetWhereQuery(strNewNodesToOpen);
                    var query1 = lstFinalDataSource.AsQueryable().WhereIn(dg => dg.CategoryId, lstShow);
                    if (lstResult != null)
                        var tbItemFound = from p in lstResult
                                          where p.CategoryId == Convert.ToInt32(strNewNodesToOpen.Split(',')[0].ToString())
                                          select p;

                        lstResult.InsertRange(0, query1.ToList());

                        dataGrdCategories.ItemsSource = query1.ToList();

                catch (Exception ex)


    Giving error:System.Linq.IQueryable <>  Doesnot contain a defination for WhereIn

    Friday, April 09, 2010 2:09 AM
  • I think you forgot to add Extensions.cs file in your Project. Check that.

    HTH Smile

    Friday, April 09, 2010 2:18 AM
  •  Oh yes, i forgot to change the namespace of Extensions.cs file.



    Friday, April 09, 2010 2:43 AM
  • My Pleasure Smile

    Friday, April 09, 2010 2:52 AM