Hi,
I have included code below,it will build a treeview in three level, but i need a better solution to be able to handle more levels = recursion
Does anyone know how to convert it to a recursive method?
Some notes about the included code :
categories is a list of objects where each have the following properties: id, parentCategoryId,name
Toplevel in the tree means that parentCategoryId == 0
For example categories contains the following
categories[0] = (id= 1, parentCategoryId=0, name="Computer")
categories[1] = (id= 4, parentCategoryId=0, name="TV")
categories[2] = (id= 7, parentCategoryId=4, name="Smart TV")
categories[3] = (id= 11, parentCategoryId=7, name="Module 1")
categories[4] = (id= 12, parentCategoryId=7, name="Module 2")
categories[5] = (id= 14, parentCategoryId=12, name="Submodule A")
Go to the complete details ...