Rendering a Treeview Control

L

lumazi

Everyone,

I'm having a bit of trouble with the Treeview control. Here's the
section of code I'm working with ...

StringBuilder defectCodeTreeSB = new StringBuilder();
TreeView defectCodeTreeView = new TreeView();
StringWriter defectCodeTreeSW = new StringWriter(defectCodeTreeSB);
HtmlTextWriter defectCodeTreeHW = new HtmlTextWriter(defectCodeTreeSW);
defectCodeTreeView.Nodes.Add(new TreeNode("TEST", "TEST"));
defectCodeTreeView.RenderControl(defectCodeTreeHW);

When I render the control I get the following error...

Object reference not set to an instance of an object.

on the line defectCodeTreeView.RenderControl(defectCodeTreeHW);

The stack trace is as follows ...


[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.UI.Control.get_SpacerImageUrl() +59
System.Web.UI.WebControls.TreeView.RenderBeginTag(HtmlTextWriter
writer) +146
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer)
+17
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
workwithexistingbatch.batchLookupButton_ServerClick(Object sender,
EventArgs e) in
d:\web\GTFWEBTEST\gtfASPX\QTS\workwithexistingbatch.aspx.cs:53
System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs
e) +105
System.Web.UI.HtmlControls.HtmlInputButton.RaisePostBackEvent(String
eventArgument) +106
System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+174
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+5102


Has anyone run across this before?

Thank you in advance for your help !

Scott Vercuski
 
C

CaffieneRush

Has anyone run across this before?
No but your error message looks like either SpacerImageUrl property or
a variable within SpacerImageUrl needs to be set.

Best regards.
 
R

rodrigosvcp

Could you resolve this problem? I'm having exactly the same behavior
and don't know what to do.
 
R

rodrigosvcp

Could you resolve this problem? I'm having exactly the same behavior
and don't know what to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top