Ask a Question related to ASP Database, Design and Development.
-
Troy Jerkins #1
Treeview ctl Populating SQL Data
I'm using the MS Treeview Control Version 5 (SP2), comctl32.ocx in an .ASP
(IIS 6) page using ADO to populate data from a SQL 2000 DB.
Their are 2 columns I'm working with. "Communities" and "ProjectNumber" in
one talble named Allprojects.
Their can be multiple ProjectNumbers for each Community which are unique to
that Community, so my tree should look as such:
- --Community1
| |___ProjectNumber1
| |___ProjectNumber2
| |___ProjectNumber3
|
- --Community2
| |___ProjectNumber4
| |___ProjectNumber5
| |___ProjectNumber6
+ --Community3
+ --Community4
+ --Community5
The problem I'm having is that I can only get one ProjectNumber to populate
as child Node under each Parent Node (Community) which looks like this:
- --Community1
| |___ProjectNumber1
|
- --Community2
| |___ProjectNumber4
|
+ --Community3
+ --Community4
+ --Community5
Here is the Code I'm using. I really need some help here. I've exhausted all
resources:
<%
'************ Construct SQL Statement ******************************
sSQL = "SELECT DISTINCT Community from AllProjects ORDER BY Community
ASC"
'************ Create Connection and Recordset **********************
Set cnn = Server.CreateObject("Adodb.connection")
cnn.open "DSN=PMwater", "sa"
Set Rs = Server.CreateObject("adodb.recordset")
Set Rs = cnnPubs.execute(sSQL)
Set objComm = Rs("Community")
'************ Populate the Control ******************************
Set objCommIX = objComm'TreeView1.Nodes.Add , , & Chr(34) & objComm &
Chr(34) & Chr(34) &_
Do While Not rstCustomers.EOF
Response.write "TreeView1.Nodes.Add , , " & Chr(34) &
objComm & Chr(34) & "," & Chr(34) &_
objComm & Chr(34) & chr(10) & chr(13)
objIX = "select ProjectNumber from AllProjects where Community =" & Chr(39)
& objComm & Chr(39) & chr(10) & chr(13)
Set Rs1 = cnnPubs.execute(objIX)
'Add author to root node.
'********* Add the titles as a child node to the author *****
Response.Write Chr(10) & "TreeView1.Nodes.Add " & Chr(34) & _
objComm & Chr(34) & ", 4, ," & Chr(34) & _
Rs1(0) & Chr(34) & chr(10) & chr(13)
Rs.MoveNext
Loop
%>
Troy Jerkins Guest
-
popup datagrid not populating data from xml
hey guys, im having trouble creating a datagrid within a popup. i created the datagrid on a normal panel and everything worked fine. then i tried... -
Populating DataGrid with nested data
Hello, I'm new to Flex and I'm having a hard time populating a dataGrid with info nested in an dynamically updatable XMLListCollection. for... -
#39647 [NEW]: Not populating $_POST data
From: security at isnnetworks dot net Operating system: Linux, Centos 4.4 PHP version: 5.2.0 PHP Bug Type: *General Issues... -
Populating DataGrid with data ...
It seems that DataGrid supports dynamic data loading only from global variables. In my case, I have something like this: "code below", where... -
populating dropdowns with sql data
I'm trying to find info on how to build a list box from mysql data. This part I can find many tutorials on however, I'm creating a form to edit all... -
Yan-Hong Huang[MSFT] #2
RE: Treeview ctl Populating SQL Data
Hello Troy,
Thanks for posting in the group.
Based on my understanding, now you are retrieving data from database and
populating it in a treeview control in client side scripting. However, for
some reason, you can only show one child node in treeview. Is it right?
In MSDN, there is a KB article which demonstrates exactly the same question
as yours. Please refer to:
"HOWTO: Populate an ActiveX TreeView Control Using ASP"
[url]http://support.microsoft.com/?id=183329[/url]
This article describes how to use Active Server Pages (ASP) code to
populate an ActiveX TreeView control. The technique shown here leverages
ASP's ability to dynamically build a VBScript function to populate a
client-side ActiveX control, based on results retrieved through ActiveX
Database Objects (ADO).
I have tested the sample code in the KB article and it works fine.
Hope that helps.
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ¨C [url]www.microsoft.com/security[/url]
This posting is provided "AS IS" with no warranties, and confers no rights.
Yan-Hong Huang[MSFT] Guest
-
Troy Jerkins #3
Re: Treeview ctl Populating SQL Data
Thanks for the reply. I had seen that Article before, but never tried to
actually run that piece of code against the Pubs DB.
Once I did and started to see what was happening in the script debugger, I
realized I need to add a column to my table that uniquely identified the
parent nodes key value.
After that everything clicked. Thanks again!!
-Troy
"Yan-Hong Huang[MSFT]" <yhhuang@online.microsoft.com> wrote in message
news:diTUz0P9DHA.2052@cpmsftngxa07.phx.gbl...question> Hello Troy,
>
> Thanks for posting in the group.
>
> Based on my understanding, now you are retrieving data from database and
> populating it in a treeview control in client side scripting. However, for
> some reason, you can only show one child node in treeview. Is it right?
>
> In MSDN, there is a KB article which demonstrates exactly the samerights.> as yours. Please refer to:
> "HOWTO: Populate an ActiveX TreeView Control Using ASP"
> [url]http://support.microsoft.com/?id=183329[/url]
>
> This article describes how to use Active Server Pages (ASP) code to
> populate an ActiveX TreeView control. The technique shown here leverages
> ASP's ability to dynamically build a VBScript function to populate a
> client-side ActiveX control, based on results retrieved through ActiveX
> Database Objects (ADO).
>
> I have tested the sample code in the KB article and it works fine.
>
> Hope that helps.
>
> Best regards,
> Yanhong Huang
> Microsoft Community Support
>
> Get Secure! ¨C [url]www.microsoft.com/security[/url]
> This posting is provided "AS IS" with no warranties, and confers no>
Troy Jerkins Guest



Reply With Quote

