Changes Cascading down to children in a Tree structure ASP.NET MVC 3 -


This is an ASP.NET MVC 3 application and for updating the children's nodes in a tree structure, the user It is allowed to make changes in any part of the node in the tree. Once the user has made a change (i.e. a status field) that the change will cascade all the children. The point is that children have an arbitrary amount and their children have an arbitrary number on children and so on.

  edit   

I would like for this structure to repeat myself, until the rest of the child will not leave

 < Code> If (unit.child.Count> 0) // Level 1 {foreach (item item in item.child item1) {// logic to update each unit (item 1.child.Count> 0 ) // Level 2 {foreach (item item..child in var item2) {// logic to update each unit if (item2.child.Count> 0) // Level 3 {Foreach (item item. Child in var item3). . .   

Is there a great way to do this, or is it just a few hard work for "best guess" numbers or levels?

You need to type recursive method:

  zero process child (Item item) {// logic 'this' baby item to update foreach (different child in item. Baby) {process baby (child); }} Process child (root item);    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -