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

Adding element at child level

2 Answers 24 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ludovic Gerbault
Top achievements
Rank 1
Ludovic Gerbault asked on 10 Apr 2010, 09:54 AM
Hello

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 Answers, 1 is accepted

Sort by
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 15 Apr 2010, 11:09 AM
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.

Greetings,
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.
0
Ludovic Gerbault
Top achievements
Rank 1
answered on 17 Apr 2010, 02:18 PM
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
Tags
GridView
Asked by
Ludovic Gerbault
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Ludovic Gerbault
Top achievements
Rank 1
Share this question
or