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!
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!