|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dynamically populating and expanding TreeView from button click...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 One of the reasons that the control is not supported I assume.
Try: Treeviewname.Nodes.RemoveAt(0) instead of clear Show quoteHide quote "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 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? Yes, I have had strange things start happening, which went away after a
reboot, many times. Show quoteHide quote "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? >
Skin and custom controls (ASP 2.0)
Another basic question: How to call and show one Web Form from another Web Form? ASP.net datagrid with more than 1 datasource Datagrid - How to format EditCommandColumn? SortCommand and custom headers - why won't they play nice? Odd Dropdownlist problem Composite Web Control ListBox not firing SelectedIndexChanged (AutoPostBack=True) Panel limitations? Validation Controls checking for a particular value |
|||||||||||||||||||||||