I have a ASP.NET treeview populated with custom treenodes (ExtensionRangeTreeNode subclassed from TreeNode). On postback the treeview is populated with TreeNodes, not my custom treenode class.
What's up with this?
Thanks, BP
I have a ASP.NET treeview populated with custom treenodes (ExtensionRangeTreeNode subclassed from TreeNode). On postback the treeview is populated with TreeNodes, not my custom treenode class.
What's up with this?
Thanks, BP
Without looking at your particular code, I can only assume that you custom TreeNode is not using ViewState. This would explain why it is not getting populated on postback.
DoesExtensionRangeTreeNode fully handle saving itself to the viewstate fully? If so, can you cast the returned nodes to that type?
Hello,
This forum entry may answer the question :
Basically, it is said a custom treeview control has to be used. CreateNode function must be overriden to instanciate the right TreeNode type. Here, it would be ExtensionRangeTreeNode instead of "CustomTreeNode".
public class CustomTreeView : TreeView
{
protected override TreeNode CreateNode()
{
return new CustomTreeNode(this, false);
}
}
Of course, you will have to add the ExtensionRangeTreeNode(Treeview treeview, bool isRoot) constructor signature to your current ExtensionRangeTreeNode implementation.