Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 425175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:21:12+00:00 2026-05-12T19:21:12+00:00

Please can you suggest me an example in classic asp and ajax to make

  • 0

Please can you suggest me an example in classic asp and ajax to make dependent combo?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:21:12+00:00Added an answer on May 12, 2026 at 7:21 pm

    Long before the concept of AJAX was formalised, I was using a technique called XML Data Islands to achieve this kind of functionality. Obviously, there are a number of AJAX frameworks and scripts that can achieve similar result, but this is just the tried-and-tested technique that I have used for years in my legacy applications.

    I can’t quickly find any suitable articles, so I’ve dug up some of my old code. Basically, when you set the value of the parent control, you run some javascript that sends a request to a separate ASP page. This page queries the DB to get determine the data that will be used to populate the child control.

    This second page returns the results as XML, which is stored and manipulated in an XML Data Island in your primary page. The calling javascript then parses the returned XML and populates the child control.

    First we have the javascript calls from the primary control:

    <tr>
                        <td>Customer:</td>
                        <td>
                            <select id="CustomerID" NAME="CustomerID" 
                                onfocus="javascript:populateCombo(fProcess.CustomerID.value)" 
                                onChange="javascript:populateCombo(fProcess.CustomerID.value)"  
                                onkeypress="javascript:populateCombo(fProcess.CustomerID.value);">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>Depot:</td>
                        <td>
                            <select name="depot" id="depot" size="1"  alt="Depot">
                                <option value="" selected >&lt;Select Depot&gt;</option>
                            </select>
                        </td>
                    </tr>
    

    Then we have the javascript which makes the call to the second page (which retrieves the data from the DB):

    // Fill combo with XML data
    function populateCombo(par) {
        var currNode;
    
        XMLID.async = false;
    
        // Change Data Island source
        strQuery = "Select LocationID, LocationName from Locations where CustomerID='" + par + "' and Active = 1 Order By LocationName";
        XMLID.SRC="/fxdb/common/xmlQuery.asp?strQuery=" + strQuery;
    
        // Get all "names" from XML data
        objNodeList = XMLID.getElementsByTagName("LocationName");
        objNodeListID= XMLID.getElementsByTagName("LocationID");
    
    
        // Fill combo with names
        for (var i=0; i < objNodeList.length; i++) {
            fProcess.depot.options[i]=new Option(objNodeList.item(i).text,objNodeListID.item(i).text);
        }
    
        // Delete extra entries
        while ( objNodeList.length < fProcess.depot.options.length) {
            fProcess.depot.options[(fProcess.depot.options.length - 1)] = null;
        } 
    
    } 
    

    And finally, the page that queries the DB itself.

    <%@ Language="VBScript" %>
    <%
    '  Declare all variables.
    Option Explicit
    Dim strSql,objRS,objField
    Dim sConn, oConn
    Dim strName, strValue
    
    
    ' Buffer and output as XML.
    Response.Buffer = True
    Response.ContentType = "text/xml"
    
    ' Start our XML document.
    Response.Write "<?xml version=""1.0""?>" & vbCrLf
    
    ' Set SQL and database connection string.
    
    set oConn=server.createobject("adodb.connection") 
    sConn=Application("Connection")
    oConn.Open sConn
    strSQL = Request.QueryString("strQuery")
    
    set objRS=oConn.execute(strSQL)
    
    ' Output start of data.
    Response.Write "<database>" & vbCrLf
    
    ' Loop through the data records.
    While Not objRS.EOF
        ' Output start of record.
        Response.Write "<record>" & vbCrLf
        ' Loop through the fields in each record.
        For Each objField in objRS.Fields
            strName  = objField.Name
            strValue = objField.Value
            If Len(strName)  > 0 Then strName = Server.HTMLEncode(strName)
            If Len(strValue) > 0 Then strValue = Server.HTMLEncode(strValue)
            Response.Write "<" & strName & ">" & vbCrLf
            Response.Write strValue & vbCrLf 
            Response.Write "</" & strName & ">" & vbCrLf
        Next
        ' Move to next city in database.
        Response.Write "</record>" & vbCrLf
        objRS.MoveNext
    Wend
    
    ' Output end of data.
    Response.Write "</database>" & vbCrLf
    %> 
    

    Edit: Oops! I forgot the all-important XML Data Island itself – add this after your Body tag.

    <!-- Data Island-->
    <XML ID="XMLID"></XML>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please suggest where can I find good resources (tutorial/books/example code etc) for this
can anyone please suggest a good code example of vb.net/c# code to put the
Can anyone please suggest me a good sample code for zooming image in NSImageView.
Can anyone please suggest a way to replace back-slash '\' with slash '/' in
Can anyone please suggest an XPath expression format that returns a string value containing
Can you please suggest to me the syntax for doing floating point comparison in
Can anyone please suggest me whether this code will cause concurrency or not. This
I am newbie in testing. Can you please suggest me some good tutorials of
Can anyone please tell/suggest me how can i store and retrieve comments multiple/different values
Can anyone please explain or suggest some good tutorial for the method of matrix

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.