ASP Code
  Home arrow ASP Code arrow Remote Scripting to dynamically add the le...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

Remote Scripting to dynamically add the leaves to a Tree Control
By: Adrian Forbes
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2003-01-01

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


     

     

    This Demo uses remote scripting to dynamically add the leaves. i.e. it loads the root items first then loads the child items when you expand the parent item.  Note:that with the remote scripting samples there is a hard-coded path to the relevant support files, this will have to be changed appropriately for people to get the demos to work on their own system. 

    First Page--RSTreeView.htm

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE>TreeView using Remote Scripting</TITLE>
    </HEAD>
    <BODY>
    <!-- Author: Adrian Forbes -->
    <script language="JavaScript" src="../_scriptlibrary/rs.htm"></script>
    <script language="JavaScript">RSEnableRemoteScripting("../_scriptlibrary");</script>

    <OBJECT ID="tvwTree" WIDTH=300 HEIGHT=276
    CLASSID="CLSID:0713E8A2-850A-101B-AFC0-4210102A8DA7">
    <PARAM NAME="_ExtentX" VALUE="7938">
    <PARAM NAME="_ExtentY" VALUE="7303">
    <PARAM NAME="_Version" VALUE="327682">
    <PARAM NAME="Indentation" VALUE="0">
    <PARAM NAME="LabelEdit" VALUE="1">
    <PARAM NAME="LineStyle" VALUE="1">
    <PARAM NAME="Style" VALUE="7">
    <PARAM NAME="Appearance" VALUE="1">
    </OBJECT>
    <p>
    <input type=BUTTON onClick="SubmitNode();" value="Select" id=BUTTON1 name=BUTTON1>
    </p>
    <form name=frmTree action="TreeControlTarget.asp" method=GET>
    <input type=HIDDEN name=txtSelected>
    </form>

    <script language=VBScript>
    strDBPage = "RSDatabase.asp"
    tvwChild = 4

    sub window_onLoad
        LoadParents
    end sub

    function LoadParents

        set objRS = RSExecute(strDBPage ,"GetDBParents")
        sRS = objRS.return_value
        aRows = Split(sRS, Chr(13))

        tvwTree.Nodes.Clear
       
        for i = 0 to UBound(aRows) - 1
            aFields = Split(aRows(i), ";")
            Set tmpNode = tvwTree.Nodes.Add(, , "P" & aFields(0), aFields(1))
            tvwTree.Nodes.Add tmpNode, tvwChild, , "DUMMY"
        next

    end function

    Sub tvwTree_Expand(ByVal Node)
    dim tmpRS, lHeaderID
    dim sOld, sNew

        If Node.Child.Text <> "DUMMY" Then
            exit sub
        end if

        tvwTree.Nodes.Remove Node.Child.Index

        lID = mid(node.Key, 2)
        set objRS = RSExecute(strDBPage ,"GetDBChildren", lID)
        sRS = objRS.return_value
        aRows = Split(sRS, Chr(13))

        for i = 0 to UBound(aRows) - 1
            aFields = Split(aRows(i), ";")
            tvwTree.Nodes.Add Node, tvwChild, "C" & aFields(0), aFields(1)
        next

    End Sub

    sub SubmitNode
        if document.tvwTree.selecteditem is nothing then
            msgbox "Select an item from the tree"
        else
            document.frmTree.txtSelected.value = document.tvwTree.selecteditem.text
            document.frmTree.submit
        end if
    end sub
    </script>

    </BODY>
    </HTML>

    Page 2 RSDatabase.asp

    <%@ LANGUAGE=VBSCRIPT %>
    <%
    strconn = "Driver={SQL Server};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;PWD=Password;DATABASE=Database_Name
    %>
    <% RSDispatch %>
    <!-- Author: Adrian Forbes -->
    <!--#INCLUDE FILE="../_ScriptLibrary/rs.asp"-->
    <SCRIPT RUNAT=SERVER Language=javascript>
        function Description()
        {
            this.GetDBParents = Function( 'return GetDBParents()' );
            this.GetDBChildren = Function('ID', 'return GetDBChildren(ID)' );
            this.Method1 = Method1;
        }
        public_description = new Description();

    function Method1()
    {
        return 'Test';
    }
    </script>

    <SCRIPT RUNAT=SERVER Language=VBScript>
        function GetDBParents()

            set objRS = createobject("ADODB.Recordset")
            objRS.Open "select ID, strParent from Parents", strconn
            GetDBParents = objRS.GetString(, , ";")
            objRS.Close
            set objRS.ActiveConnection = nothing
            set objRS = nothing
           
        end function

        function GetDBChildren(ID)

            set objRS = createobject("ADODB.Recordset")
            objRS.Open "select ID, strChild from Children WHERE intParent=" & ID, strconn
            GetDBChildren = objRS.GetString(, , ";")
            objRS.Close
            set objRS.ActiveConnection = nothing
            set objRS = nothing
           
        end function
    </SCRIPT>





    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By Adrian Forbes

     

    IBM® developerWorks developerWorks - FREE Tools!


    IBM – Taking Web 2.0 to Work

    You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve.
    FREE! Go There Now!


    NEW! Achieving True Agility -- How process can change the behavior of your tools

    Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools.
    FREE! Go There Now!


    NEW! Build Web services with transport-level security using Rational Application Developer V7, Part 1: Build Web services and Web services clients

    Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services.
    FREE! Go There Now!


    NEW! Don't wait! Try the Rational Application Developer (RAD) v7.5 open beta code today

    Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems.
    FREE! Go There Now!


    NEW! Download IBM WebSphere Portal V6.1 beta code

    Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization.
    FREE! Go There Now!


    NEW! IBM Rational ClearCase Innovator's Series

    Learn from the best! Find out how developers use Rational ClearCase to be more flexible, innovative and deliver higher quality code in the Rational ClearCase Power Users eKit. This complimentary eKit provides a collection of materials, like articles, whitepapers, and demos that can help you become a power user of Rational ClearCase.
    FREE! Go There Now!


    NEW! Project and Portfolio Management Executive Resource Kit

    Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle.
    FREE! Go There Now!


    NEW! Rational Talks to You: Grady Booch on Architecture

    Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered!
    FREE! Go There Now!


    NEW! Software Change and Configuration Management Solution Guidelines

    This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for People

    Visit IBM developerWorks to try the IBM SOA Sandbox for people. The SOA Sandbox for people provides a trial environment with the necessary tooling and components required to enable consistent human and process interaction and collaboration, showing how you can improve user experience and business productivity.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Various methods of setting Date values to a ...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT