Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Dynamically populating and expanding TreeView from button click...

Reply
Thread Tools

Dynamically populating and expanding TreeView from button click...

 
 
John Roper
Guest
Posts: n/a
 
      06-15-2005
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
 
Reply With Quote
 
 
 
 
Harolds
Guest
Posts: n/a
 
      06-15-2005
One of the reasons that the control is not supported I assume.
Try:
Treeviewname.Nodes.RemoveAt(0)
instead of clear

"John Roper" wrote:

> 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

 
Reply With Quote
 
 
 
 
John Roper
Guest
Posts: n/a
 
      06-15-2005
Thanks for taking the time to reply.... I had already tried that. In fact I
tried commenting out all my code and it still happened. So I rebooted and now
everything works fine. Has anyone come across this sort of behaviour?

 
Reply With Quote
 
Harolds
Guest
Posts: n/a
 
      06-15-2005
Yes, I have had strange things start happening, which went away after a
reboot, many times.

"John Roper" wrote:

> Thanks for taking the time to reply.... I had already tried that. In fact I
> tried commenting out all my code and it still happened. So I rebooted and now
> everything works fine. Has anyone come across this sort of behaviour?
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TreeView not expanding in some browsers mfr ASP .Net Web Controls 25 04-25-2012 02:06 PM
Expanding a treeview without postback JJ ASP .Net 26 03-19-2007 09:31 PM
Treeview Client side expanding and collapsing of nodes JamesHead ASP .Net Web Controls 0 01-24-2005 01:55 PM
TreeView dynamic DataBinding and problem with Expanding volts ASP .Net 0 04-07-2004 10:00 AM
Expanding Treenodes dynamically on client side Sunny ASP .Net Web Controls 1 10-06-2003 11:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57