Posted on: 3/17/2011 10:03:03 AM | Views : 398

I have read many posts in the past about TreeView in Custom CompositeControls and using RenderControl but have yet to see a solution.  I declare a new Tree in the CreateChildControls method and in the render I try to call the RenderControls method and it gave me an object reference not set to instance of an object error.  I have set the SkipLinkText to Nothing, String.Empty and "".  Once I do that I get the second stack trace.  The control worked when it was a control on the aspx page.  Any solutions?
Me._StateTree = New TreeView Me._StateTree.ID = Me.ID & "_StateTree" Me._StateTree.ShowCheckBoxes = TreeNodeTypes.Leaf Me._StateTree.Attributes.Add("style", "padding: 0px; margin 0px") Me._StateTree.Nodes.Add(LoadTreeView(StateData, "Select State(s)", "STATE", "STATE_ID")) Me._StateTree.SkipLinkText = ""  STACK TRACE
at System.Web.UI.WebControls.TreeView.GetImageUrl(Int32 index) ...

Go to the complete details ...