We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

newbie: TreeViewAdv fill on demand

I'm having a problem with the TreeViewAdv control (Essential Suite 1.6.1.8), but I suppose it's just my fault: in my application, a treeview should allow the child nodes to be filled on demand when the user clicks the [+] to expand the node. Here's a sample dummy code: I create a windows forms project and: 1) I insert a treeview (named _tree) into a form and set its LoadOnDemand=True, FullRowSelect=True; all the other properties are left unchanged to their defaults. 2) I add a handler for BeforeExpand and implement it as follows: if ((e.Node.ExpandedOnce) || (e.Node.Parent != _tree.Root)) return; for (int i=1; i<=3; i++) e.Node.Nodes.Add(new TreeNodeAdv(i.ToString())); (=just add 3 children to the expanding node). 3) I add a button which when clicked does the following: _tree.Nodes.Clear(); for (int i=0; i<10; i++) _tree.Nodes.Add(new TreeNodeAdv(new string((char)(i+65),1))); (=clear the tree and then add 10 nodes to the root node, with the text "A", "B"... and so on). Now, when I click the 1st time the button, the tree is filled; then I expand any node, and the BeforeExpand handler is called and appends 3 children as expected. BUT when I click it again, the tree is cleared and nothing is shown; if I click it again, I get this exception: "An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll Additional information: '0' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'." at the line: _tree.Nodes.Add(new TreeNodeAdv(new string((char)(i+65),1))); What I'm doing wrong in clearing and then refilling the tree? How the fill-on-demand feature is supposed to be correctly used? Thanks guys...

4 Replies

AS Arun Srinivasan Syncfusion Team October 28, 2003 08:17 PM UTC

Hi Daniele Your code seems to be fine. Can you upload a sample so that we can take a look at what could be causing this? Thanks Arun


DF Daniele Fusi October 29, 2003 12:20 PM UTC

> Your code seems to be fine. Can you upload a sample so that we can take a look at what could be causing this? > > Thanks > Arun Here it is the dummy test project. Thanks in advance!


AS Arun Srinivasan Syncfusion Team October 29, 2003 01:40 PM UTC

Hi Daniele There is an issue with Clear() being called when the scrollbar is visible in the TreeViewAdv control. The Essential Tools team is looking into this issue and we apologize the inconvenience this has caused. Regards, Arun


DF Daniele Fusi October 29, 2003 03:59 PM UTC

Many thanks for your reply; could you please tell me how can I be notified of the fix? Should I just check this forum?

Loader.
Up arrow icon