Treeview object in ASP

H

HarryD

Hello,
Maybe someone can help?

According to ms kb-article 183329 i am trying to populate a treeview object
on a asp-page, with realtime data from a accessdatabase.
The database routine works fine and correctly returns the required records,
the treeview object is not populated.
The syntax of the treeview1.nodes.add statement is correct (have them
written to the browser to check) but still no entries in the object.

i searched almost the entire internet ;-), but found no solution? Please
help....


Intention is that a database with only one table is read, which contains all
members of a family. The table contains a parent-child id as well, so,
knowing the most toplevel (which is the starting point) it is possible to
drilldown to the youngest member in the family.
I build the same stuff into VB itself (v6) and that works fine.


Code is as follows:
<%@ LANGUAGE="VBSCRIPT"%>

<%
Response.Expires = -1
dq = Chr(34)

'Open connection to database
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DBQ=D:\Inetpub\webdata\family.mdb;Driver={Microsoft Access Driver
(*.mdb)};DriverId=25;FIL=MS Access;"

Sub main()
Dim First_Node
First_Node = "F235M234"
Call Retrieve_Tree(First_Node)
End Sub

Sub Retrieve_Tree(Parent)

SQLStr = "Select ID, PartnerID, MarriageID, IDParentMarriage, Lastname,
FirstName from Persons where IDParentMarriage = '" + Parent + "' ORDER BY
DateOfBirth"
Set rs = Conn.Execute (SQLStr)

If rs.EOF Then
Exit Sub
End If

If Not rs.EOF Then
rs.MoveFirst
End If

While Not rs.EOF
strName = rs("Lastname") & ", " & rs("Firstname")
OwnID = rs("MarriageID")
ParentID = rs("IDParentMarriage")

'Nu afdrukken, maar ook functie aanroepen die TreeView1 object vult, met
parameters
'Response.Write strName & "<BR>"
Call FillTreeNew (OwnID, ParentID, strName,4)

Response.Write "<BR>"

Call Retrieve_Tree (rs("MarriageID"))
rs.MoveNext
Wend


End Sub

%>

<SCRIPT LANGUAGE="VBScript">
<%
Sub FillTreeView(OwnID,ParentID,strName)
Response.Write "TreeView1.Nodes.Add " & dq & ParentID & dq & ",tvwChild,"
& dq & OwnID & dq & "," & dq & strName & dq
End Sub
%>
</SCRIPT>

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 4</title>
<LINK HREF="/Stylesheets/content.css" REL="STYLESHEET" TYPE="TEXT/CSS">
</head>

<body>

<OBJECT ID="TreeView1" WIDTH=400 HEIGHT=500
CLASSID="CLSID:0713E8A2-850A-101B-AFC0-4210102A8DA7">
<PARAM NAME="_ExtentX" VALUE="7938">
<PARAM NAME="_ExtentY" VALUE="10583">
<PARAM NAME="_Version" VALUE="327682">
<PARAM NAME="LineStyle" VALUE="1">
<PARAM NAME="Style" VALUE="6">
<PARAM NAME="Appearance" VALUE="1">
</OBJECT>


<p>Content</p>
<HR>

<%
FillTreeNew "F235M234","NULL","STAALBERG, Hendrik", 0
Response.Write "<BR>"
Main
%>

<SCRIPT LANGUAGE="VBScript">
TreeView1.Font.Name = "Tahoma"
TreeView1.Font.Size = 9
TreeView1.Nodes.Add "NULL",0,"F235M234","STAALBERG, Hendrik"

<%
Sub FillTreeNew(OwnID,ParentID,strName,Prm)
'************ Populate the Control ******************************
Response.Write Chr(10) & "TreeView1.Nodes.Add " & dq & ParentID & dq &
"," & Prm & "," & dq & OwnID & dq & "," & dq & strName & dq & chr(10) &
chr(13)
End Sub
%>
</SCRIPT>




<%
Conn.Close
Set rs = Nothing
Set Conn = Nothing
%>

</body>

</html>
 
C

Curt_C [MVP]

can you manually populate it at all (leaving out all the ASP lookups).
This will tell you if you have an ActiveX issue or an ASP one
 
H

HarryD

Yep, if i leave out the sub/end sub at the FillTreeNew, and leave out this
part of the body:
<%
FillTreeNew "F235M234","NULL","STAALBERG, Hendrik", 0
Response.Write "<BR>"
Main
%>

i am able to populate the treeview manually.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top