Click to See Complete Forum and Search --> : Easy Question
iandarbyshire
Mar 1st, 2001, 07:29 AM
I am a VB programmer that has gone headfirst into ASP / VBScript.
I have a webpage with a combo list box (populated from querying a database) and a treeview control. I can get the individual elements to work in isolation, but how do I use the value of the combo box as a parameter for the query populating the treeview control?
Can I just reference it direct or do I have to submit it via a form.....
I am using the SAMS Learn ASP in 24hrs - can anyone recommend a better book?
Thanks
Ian
First on the book thing: I followed the same route as you did, also from VB programming into ASP and VBScript, and I used the book called "Professional Active Server Pages 2.0" (ISBN: 1-861001-26-6) and found it quite usefull.
As for your question: I've been out of actual VB (and treeviews and all) for too long now to remember the fine details about it, but if you wanna get data from a control on a page to use for another control in that same page, you either have to call that page again and get the data from the form you submitted, or you have to do something using DHTML and Javascript (anybody correct me if I'm wrong, please).
jdavison
Mar 1st, 2001, 08:25 AM
no, your pretty much right if he's using an html page. If its an ocx control he could trigger an event on the page and would then run whatever javascript he wants for it. Ass far as how to do it im not exactly sure but there is info about it somewhere.
monte96
Mar 1st, 2001, 01:31 PM
You have to keep in mind the separation between client side and server side. Any query to the database is on the server side, and any interaction with controls whether they are ActiveX controls or HTML form objects, is done on the client side. The only way to accomplish a change in the actual query, would be to refresh or reload the page with a querystring.
Now, if you have a relatively small set of data, you can populate an array in client side Javascript by using Response.Write to create the client side scripts and populate the arrays. Then in the onChange() events for the dropdown, you can repopulate the other controls from the client side arrays without another round trip to the server.
BTW- The book on ASP from Wrox press is excellent if you already know VB.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.