Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old February 6th, 2004, 09:52 AM
Rich's Avatar
Rich Rich is offline
Administrator
Developer Shed Admin.
 
Join Date: Sep 2003
Location: Fort Lauderdale, FL
Posts: 151 Rich User rank is Sergeant (500 - 2000 Reputation Level)Rich User rank is Sergeant (500 - 2000 Reputation Level)Rich User rank is Sergeant (500 - 2000 Reputation Level)Rich User rank is Sergeant (500 - 2000 Reputation Level)Rich User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 11 h 37 sec
Reputation Power: 10
Two linked combos populated using remote scripting.

This is the remote scripting file used by RSCombos and RSTreeView.htm. 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. These demo's only work with Internet Explorer 5.0. First Page ...

This is the remote scripting file used by RSCombos and RSTreeView.htm. 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. These demo's only work with Internet Explorer 5.0.

First Page--RSCombos.htm

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Two Combos using Remote Scripting</TITLE>
</HEAD>
<BODY>
<!-- Author: Adrian Forbes -->
<script language="JavaScript" src="../_scriptlibrary/rs.htm"></script>
<script language="JavaScript">RSEnableRemoteScripting("../_scriptlibrary");</script>
<p>
<select onChange="PopulateChildren()" name=cboParents ID=cboParent size=1>&nbsp;</select><select name=cboChildren ID=cboChildren size=1></select>
</p>

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

sub Window_onLoad
PopulateParent
PopulateChildren
end sub

sub PopulateParent

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

for i = 0 to UBound(aRows) - 1
aFields = Split(aRows(i), ";")
set objOption = document.createElement ("OPTION")
objOption.Value = aFields(0)
objOption.Text = aFields(1)
objParents.add objOption
next
end sub

sub PopulateChildren
set objParents = document.all("cboParents")
set objChildren = document.all("cboChildren")
while objChildren.length > 0
objChildren.remove (0)
wend

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

for i = 0 to UBound(aRows) - 1
aFields = Split(aRows(i), ";")
set objOption = document.createElement ("OPTION")
objOption.Value = aFields(0)
objOption.Text = aFields(1)
objChildren.add objOption
next
end sub
</script>
</BODY>
</HTML>

Page 2 RSDatabase.asp

<%@ LANGUAGE=VBSCRIPT %>
<%
strconn = "Driver={SQL Server};Description=sqldemo;SERVER=127.0.0.1;UID=L oginID;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>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Two linked combos populated using remote scripting.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway