2012-06-21 75 views
0

展開asp:treeView如何獲取已耗費的索引?c#TreeView獲取父節點索引

我試圖調查:ontreenodeexpanded =「Node_Expand」,但我無法找到被單擊的父根的索引。

感謝,

回答

2

您展開節點是event arguments的節點屬性:

// Inside the event handler method 
TreeNode clickedNode = e.Node; 

你可以得到它與被存儲節點的TreeNodeCollectionIndexOf方法索引。

+0

srry,令人困惑的不是父節點,而是當點擊(+)符號展開父節點時。 – Ben

+0

節點具有另一個節點對象的父屬性(如果它是根節點,則爲null)。它的子節點在它的節點propery(TreeNodeCollection) – nXu