Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 3rd, 2003, 05:51 AM
Authorized User
 
Join Date: Aug 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks pgtips
Its just slow when creating the tree to start with
Lbob

 
Old September 3rd, 2003, 06:03 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hmm, probably not much you can do about it. You are creating a lot of nodes, so a With statement would speed things up by keeping a reference to the treeview nodes collection rather than having to look it up over and over again. What I mean is that instead of each line (of client-side vbs) being TreeView1.Nodes.Add(...), change it to either
Code:
With TreeView1.Nodes
   Call .Add(...)
   ...
End With
Beware though, that with isn't supported on older vbs versions, so if you're not sure what version your users have then you may be safer seeting an explicit object reference like this:
Code:
Dim xNodes
Set xNodes = Treeview1.Nodes
xNodes.Add(...)
xNodes.Add(...)
...
this will make your code run quicker, but whether you'll actually notice it is anyone's guess.

hth
Phil
 
Old September 3rd, 2003, 07:18 AM
Authorized User
 
Join Date: Aug 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for that.
Another question though! In VB when you use this control you have node_click. I take it, the same applies in ASP, but how?!
Sorry to be a pain
lbob

 
Old September 3rd, 2003, 07:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Strictly speaking the events such as click have nothing to do with your asp. The treeview is running in the browser, so you must have client-side vbs to handle the click event. I don't know the exact syntax as I've never used the treeview control, but as an example, if you added this code to your client-side <script> section you'll get a message every time you click a node
Code:
Sub TreeView1_click
    MsgBox "got the click!"
End Sub
hth
Phil
 
Old September 3rd, 2003, 07:43 AM
Authorized User
 
Join Date: Aug 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks
I've done the following to expand it and get the info out so I can process it display the node details.
Sub Treeview1_NodeClick(Node)
    Treeview1.SelectedItem.Expanded = true
    msgbox Treeview1.SelectedItem.Index
End Sub
Thanks for all your help, its most appeciated.
Lbob








Similar Threads
Thread Thread Starter Forum Replies Last Post
treeview SAIGORTI SQL Language 2 September 6th, 2005 07:31 PM
Treeview dkr72 VBScript 0 November 9th, 2004 12:07 PM
treeview suzila Javascript 1 December 3rd, 2003 07:07 AM
TreeView karpagameena C# 1 September 7th, 2003 04:38 AM
Treeview shiju ADO.NET 0 August 22nd, 2003 10:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.