Hi,
I'm having a problem getting a databound tree to render using templates. Using the sample Demo_ServerTemplates page, I removed the static nodes from the source (i.e. removed the element and children) and added data source binding in the treeview's Load event:
protected void flyTreeView_Load(object sender, EventArgs e)
{
// init my data source
MyHierarchicalDataSource myDS = new MyHierarchicalDataSource();
...
// bind
flyTreeView.DataSource = myDS;
flyTreeView.DataBind();
// set node type on root nodes
foreach (FlyTreeNode node in flyTreeView.Nodes)
{
node.NodeTypeID = "name";
}
}
(using version 4.0.102.0)
The binding works great and the tree structure is as expected. The rendered root level nodes, however, are the same as their children: setting the NodeTypeID this way does not appear to have any effect.
If I populate the tree programatically (i.e. flyTreeView.Nodes.Add(node)) in this event and set the NodeTypeID property it works, so what is difference with bound nodes? Is there a way to make this work?
Thanks,
Warren