Dynamic Creation of TreeView inside of DataColumn - Please Help.

P

pbd22

Hi All.


Can somebody please help me with treeview code.

Basically, I have a datacolumn called "Folders" and

I am using a loop to populate the rows with data.

I want the data to appear in the form of a treeview.

The loop looks like this:



dcol = new DataColumn("Folders",
typeof(System.String));
dt.Columns.Add(dcol);


for (int i = 0; content != null && i <
content.Length; i++)
{

if (content != null)
{

DataRow drow = dt.NewRow();

// TreeView Column

drow["Folders"] =
MakeTree(GetValue(content.data, "Name"));

....

The GetValue function just processes the key/value pair and returns a
path string such as "/Companies/Microsoft/Management/Bill_Gates"



The Make Tree function then is supposed to turn that string into a
tree, returning the results to the datarow of the datacolumn.



I have tried various forms of the method:



// SHOULD I BE DECLARING THIS AS "TREEVIEW" TO

// GET THE TREEVIEW TO APPEAR IN THE DATACOLUMN?

private TreeView MakeTree(string title)
{

//turns the string into an array

string[] sf = title.Split('/');



//take the array and use the first position

//for the tree's root node. The leaves are

//the following positions in the array.


// I COULD USE HELP HERE

// How Do I take the array created

// above and turn it into nodes of a

// treeview, returning the results.


TreeView view = new TreeView();
view.Nodes.Add("Some Node");


// WHAT SHOULD I BE RETURNING?
return view;


}



I would seriously appreciate help here. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top