Treeview object in ASP

Ask a Question related to ASP, Design and Development.

  1. #1

    Default 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>



    HarryD Guest

  2. Similar Questions and Discussions

    1. TreeView in ASP
      How to fill treeview in ASP? Thanks
    2. Once again about treeview in ASP
      Hi guys, I want to use Microsoft treeview control (no other) in my asp page and fill it with parent-child information from datatable. I draged and...
    3. Treeview object using 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...
    4. About Treeview
      Dotnet Framework 1.1 does not support IE web controls,so what's the better treeview solution now?
    5. ASP.NET Treeview example anyone ?
      I'm trying to get the TreeView control from the Microsoft.Web.UI.WebControls namespace to work but for some reason it won't render correctly. I've...
  3. #2

    Default Re: Treeview object in ASP

    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
    [url]http://www.Darkfalz.com[/url]
    ---------------------------------------------------------
    ...Offering free scripts & code snippits for everyone...
    ---------------------------------------------------------


    "HarryD" <motocasey@hotmail.com> wrote in message
    news:3f5e3374$0$37033$e4fe514c@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>
    >
    >
    >

    Curt_C [MVP] Guest

  4. #3

    Default Re: Treeview object in ASP

    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:eGgdD5xdDHA.1620@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
    > [url]http://www.Darkfalz.com[/url]
    > ---------------------------------------------------------
    > ..Offering free scripts & code snippits for everyone...
    > ---------------------------------------------------------
    >
    >
    > "HarryD" <motocasey@hotmail.com> wrote in message
    > news:3f5e3374$0$37033$e4fe514c@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>
    > >
    > >
    > >
    >
    >

    HarryD Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139