Adding element at child level

3 posts, 1 answers
  1. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 10 Apr 2010 Link to this post


    I'm facing some problems using the hierarchical grid.

    Here's my scenario :

    I have a Hierarchical RadGrid which is using a source of self referencing objects.

    Here's the definition of the class :

     public class NomenclatureHierarchy 
            public NomenclatureHierarchy(donnees_grilleBO menu) 
                _menu = menu; 
                _sous_menu = new List<NomenclatureHierarchy>(); 
            public donnees_grilleBO _menu; 
            public donnees_grilleBO _Menu { get { return _menu; } } 
            List<NomenclatureHierarchy> _sous_menu; 
            public List<NomenclatureHierarchy> _Sous_menu { get { return _sous_menu; } } 

    Depending on my WCF Data, I'm builing an IList of NomenclatureHierarchy and I have a recursive method to populate each one of them.
    I'm setting a PropertyRelation on the _Sous_menu property and dynamically bind each column to each member of the donnees_grilleBO class.

    Everything works as expected so far, I have a N-deep hierarchical RadGrid.

    I'm working now to add the possibility to add records from the grid, using insert and delete key.
    It works fine at the first level, but hitting the Insert Key when I'm focusing one of the sublevels only causes the focus to be lost, the addingnewitem event isn't being raised at all.

    What would be the correct way to add an item on a sublevel ? (and of course, create a sub level on a row when there isn't one )

  2. Answer
    Nedyalko Nikolov
    Nedyalko Nikolov avatar
    871 posts

    Posted 15 Apr 2010 Link to this post

    Hello Subileau Pascal,

    In order to make this working you have to add a default (parameter less) constructor to your business object implementation. However there is very nice and flexible alternative - you can use RowDetails feature to meet your goals. I'm attaching a sample project that demonstrates this approach. Let me know if this does not help.

    Nedyalko Nikolov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 17 Apr 2010 Link to this post

    That wasn't exactly what I needed, but I was able to modify your project to suit exactly what I needed.

    Now, I just have to handle the roweditended event to perfom database logic, and that should do the trick.

    Thanks Nikolov
Back to Top