I
Ionutz
Hello!
I derived a control from the standard TreeView control of ASP.NET 2.0, which
uses custom tree nodes derived from the TreeNode class.
The problem is that when I set the property PopulateOnDemand = true on a
node of my tree view and try to expand the node, I receive a
System.NullReferenceException with the folowing stack trace:
at System.Web.UI.WebControls.TreeNode.RenderChildNodes(HtmlTextWriter
writer, Int32 depth, Boolean[] isLast, Boolean enabled)
at System.Web.UI.WebControls.TreeView.RaiseCallbackEvent(String
eventArgument)
at
System.Web.UI.WebControls.TreeView.System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
When I don't use the populate on demand feature everything works fine.
Here is a snippet of the code that I wrote:
public class MyTreeView : TreeView
{
...
protected override TreeNode CreateNode()
{
return new MyTreeNode();
}
...
}
public class MyTreeNode : TreeNode
{
public MyTreeNode(string text) : base(text)
{
}
}
Also I handled the event TreeNodePopulate to get my nodes data.
Does anyone encountered this problem and is there a workaround for this ?
I mention that I use VS 2005 beta 2.
Thank you,
I derived a control from the standard TreeView control of ASP.NET 2.0, which
uses custom tree nodes derived from the TreeNode class.
The problem is that when I set the property PopulateOnDemand = true on a
node of my tree view and try to expand the node, I receive a
System.NullReferenceException with the folowing stack trace:
at System.Web.UI.WebControls.TreeNode.RenderChildNodes(HtmlTextWriter
writer, Int32 depth, Boolean[] isLast, Boolean enabled)
at System.Web.UI.WebControls.TreeView.RaiseCallbackEvent(String
eventArgument)
at
System.Web.UI.WebControls.TreeView.System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
When I don't use the populate on demand feature everything works fine.
Here is a snippet of the code that I wrote:
public class MyTreeView : TreeView
{
...
protected override TreeNode CreateNode()
{
return new MyTreeNode();
}
...
}
public class MyTreeNode : TreeNode
{
public MyTreeNode(string text) : base(text)
{
}
}
Also I handled the event TreeNodePopulate to get my nodes data.
Does anyone encountered this problem and is there a workaround for this ?
I mention that I use VS 2005 beta 2.
Thank you,