Last post Jun 05, 2009 09:11 AM by Dynamic2008
Mar 18, 2008 06:21 PMfirstname.lastname@example.org|LINK
I have created two custom tree nodes, one for a parent and one for a child. I've created two custom nodes as I need to render a different set of buttons beside each node. I have also created a custom TreeView and have attempted to override the CreateNode method.
However I' not sure how to implement the CreateNode method. The following code snippet illustrates what I'm trying to accomplish.
protected override TreeNode CreateNode()
return new ParentNode();
return new ChildNode();
return new TreeNode();
Mar 19, 2008 10:40 PM|Nai-Dong Jin - MSFT|LINK
The CreateNode method is a helper method that returns a new instance of the TreeNode class.
The CreateNode method is used primarily by control developers. Control developers that want to extend the TreeView class by extending the TreeNode class should override this method to return an object that derives from the TreeNode. A common reason to extend
the TreeNode class is to override the RenderPreText and RenderPostText methods.
For more information, see:
Mar 22, 2008 10:50 AMemail@example.com|LINK
Thanks for your replay,
However this is info I already knew. The reason I derived two different classes from TreeNode was precisely to override RenderPostText in two unique ways. I want the parent node to have a button to create a new child and delete itself and I want child nodes
to have buttons such as delete, manage etc. I have also extended the TreeView control and I was attempting to override the CreateNode method. But to do this I would like to have logic in the CreateNode method that decides which type of TreeNode to return i.e.
new ChildNode() or new ParentNode(), is this possible?
Jun 05, 2009 09:11 AM|Dynamic2008|LINK
I have the same issue,
Did you find the solution?