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);
}
}
我一直在敲打我的頭在這一個很長一段時間,任何建議將不勝感激。