TreeView:Cannot add subtrees from xml [using

M

Manfred Braun

Hi All,

what I am trying to do is:
- create the root-node via Code
- add subtrees from xml-file(s)

My code do not fail, but my newly created nodes do not have a subtree or any
content.

I have the following code [excepert, "TreeView1" is my treeview]

private void Page_Load(object sender, System.EventArgs e)

.................

TreeView1.TreeNodeTypeSrc = defaultNodeTypesFilename;
TreeNode treenode = new TreeNode();
treenode.Target = "Content";
treenode.Type = "Item";
treenode.Text = "Overview";
treenode.NavigateUrl = "Overview.htm";

TreeView1.Nodes.Add(treenode); //ok [root]

AddNode(TreeView1); //ok

AddNodeFromXml(TreeView1, staticXml, staticXsl); //empty node, no
tree

TreeView1.SelectedNodeIndex = dynamicStartNodeIndex;
TreeView1.DataBind();
}

private void AddNodeFromXml(TreeView tv, string xmlFilename, string
xslFilename) //empty result
{
TreeNode treenode = new TreeNode();
treenode.TreeNodeSrc = xmlFilename;
treenode.TreeNodeXsltSrc = xslFilename;
tv.Nodes.Add(treenode);
}

private void AddNode(TreeView tv) // works
{
TreeNode treenode = new TreeNode();

treenode.Target = "Content";
treenode.Type = "Item";
treenode.Text = "Test from AddNode()";
treenode.NavigateUrl = "empty.htm";
tv.Nodes.Add(treenode);
}

If I load my files into the TreeView itself, the tree is build and
displayed. And my xml/xsl is correct.
Any help would be great!!!!!

Best regards,
Manfred Braun

(Private)
Mannheim
Germany

mailto:[email protected]
(Remove the anti-spam-underscore to mail me!)
 

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,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top