views:

354

answers:

1

I have created an extended TreeView that overrides the CreateNode method to return an extened TreeNode like so

public class SiteMapTreeView : System.Web.UI.WebControls.TreeView
{
    protected override TreeNode CreateNode()
    {
        return new SiteMapTreeNode();
    }
}

The problem is that the overridden RenderPreText method on the extended TreeNode is not firing. The extended TreeNode code is as below

public class SiteMapTreeNode: System.Web.UI.WebControls.TreeNode
{
    protected override void RenderPreText(HtmlTextWriter writer)
    {
        writer.Write("pre text here");
        base.RenderPreText(writer);
    }
}

The RenderPreText is completely ignored here. I am using .net 3.5 and have tried calling this from the extended TreeView to force it to create the extended TreeNode but it fails to do so.

protected override void CreateChildControls()
{
    this.Controls.Clear();
    base.CreateChildControls();
}

Any Ideas?

Thanks in advance!

A: 

If your treenodes declared in the aspx markup than CreateTreeNode method is not invoked/// :( why? I don't know ///

dushes