467,879 Members | 1,259 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,879 developers. It's quick & easy.

Treeview object in ASP

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={Microso ft 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>

Jul 19 '05 #1
  • viewed: 3571
Share:
2 Replies
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

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"HarryD" <mo*******@hotmail.com> wrote in message
news:3f***********************@dreader5.news.xs4al l.nl...
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={Microso ft 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>

Jul 19 '05 #2
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.

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:eG**************@TK2MSFTNGP12.phx.gbl...
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

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
..Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"HarryD" <mo*******@hotmail.com> wrote in message
news:3f***********************@dreader5.news.xs4al l.nl...
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={Microso ft 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>


Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Steve | last post: by
3 posts views Thread by feel | last post: by
2 posts views Thread by Trond Hoiberg | last post: by
8 posts views Thread by Hrvoje Voda | last post: by
3 posts views Thread by Gary Dunne | last post: by
7 posts views Thread by Jonas | last post: by
2 posts views Thread by casManG | last post: by
9 posts views Thread by auntiejack56 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.