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
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