0
我想动态地填充sharepoint webpart上的treeview对象。出于某种原因,节点群体会自动触发并且无需用户输入。以下是我如何设置树和webpart的示例。动态树视图人口在sharepoint webpart
有关如何防止自动填充的任何建议,将不胜感激。
以下是CreateChildControls方法:
this.Tree = new TreeView();
this.Tree.EnableClientScript = false;
this.Tree.PopulateNodesFromClient = true;
this.Tree.Nodes.Add(this.FetchTreeNode());
this.Tree.TreeNodePopulate += new TreeNodeEventHandler(Tree_TreeNodePopulate);
处理程序是这样的:
void Tree_TreeNodePopulate(object sender, TreeNodeEventArgs e)
{
List<MyNode> children = this.FetchChildren(e.Node.Value);
foreach (MyNode child in children)
{
TreeNode node = new TreeNode(child.Name, child.UniqueId, child.IconPath);
node.PopulateOnDemand = true;
node.SelectAction = TreeNodeSelectAction.Expand;
e.Node.ChildNodes.Add(node);
}
}
我一直在敲打我的头在这一个很长一段时间,任何建议将不胜感激。