J
John Roper
Hi,
I have a tree control using Microsoft.Web.UI.WebControls.TreeView. We use
this to display a file/folder hierarchy. We only populate the top level on
page load, but we do add a single node for every folder with the text
"Working...". When a folder is opened, the Working... is displayed and then
we populate the nodes in the expand handler and everything works.
I have now added a button to populate and expand to a sub-file/folder. I
need to clear out the "Working" text and then populate with the real data. I
use ...Nodes.Clear() to do this, before adding in the new nodes. All my code
appears to work, but after my button click handler has completed I get a
NullReferenceException from System.UI.Control.OnBubbleEvent(Object source,
EventArgs args) [from RaiseBubbleEvent, OnCommand, RaisePostBackEvent,
ProcessRequestMenu).
If I remove the Nodes.Clear() everything works (although the Working...
nodes are left of course). Can anyone explain what's going on and what I
should do to avoid this exception please?
Thanks in advance
John Roper
I have a tree control using Microsoft.Web.UI.WebControls.TreeView. We use
this to display a file/folder hierarchy. We only populate the top level on
page load, but we do add a single node for every folder with the text
"Working...". When a folder is opened, the Working... is displayed and then
we populate the nodes in the expand handler and everything works.
I have now added a button to populate and expand to a sub-file/folder. I
need to clear out the "Working" text and then populate with the real data. I
use ...Nodes.Clear() to do this, before adding in the new nodes. All my code
appears to work, but after my button click handler has completed I get a
NullReferenceException from System.UI.Control.OnBubbleEvent(Object source,
EventArgs args) [from RaiseBubbleEvent, OnCommand, RaisePostBackEvent,
ProcessRequestMenu).
If I remove the Nodes.Clear() everything works (although the Working...
nodes are left of course). Can anyone explain what's going on and what I
should do to avoid this exception please?
Thanks in advance
John Roper