Hi,
Here's my problem. I have an ASP page using VBScript and JavaScript and reading SQL Server 2000 database.
I want to display client and contact information on my webpage based on which 1)Client is selected and then 2) which contact for that client is selected.
SELECTION 1
===========
Client A
Client B
etc...
if Client A is selected then read from the DB and retrieve all of the Contacts for Client A and display in another dropdown selection list.
SELECTION 2
Contact 1
Contact 2
etc... for (Selected - Client A)
Once the contact is selected from SELECTION 2 then
display addresses, phone numbers etc...
I would like to populate text boxes that have already been
defined on default.asp but I just can't seem to figure it out.
I have managed to get the Contacts populated into a dynamic dropdown selection box using an inline form but I can't figure out how to get the other information.
<%@ LANGUAGE="VBScript" %>
<!-- METADATA Type="TypeLib" File="c:\program files\common files\system\ado\msado15.dll" -->
<!--#include virtual="/projects/project/IASUtil.asp"-->
<%
Set Conn1=Server.CreateObject("ADODB.Connection"
Conn1.Open "Provider=SQLOLEDB;Integrated Security=SSPI;Initial Catalog=nnn;Data Source=nnn"
Set RS1=Conn1.Execute("asp_spProjectDataSheet"
%>
<SCRIPT language="JavaScript1.2">
function getIframe()
{
document.form1.contact.value=parent.iframe1.document.form2.elements[0].value;
}
</script>
<TABLE border="0" cellspacing="0" bgcolor='f0f0f0' width="100%">
<tr>
<TD>CLient: </td>
<td>
<select name="nclient" style="Width:200" onchange='loaddetail(this.value);document.getElementById("iframe1".src="getcontacts.asp?ClientID="+ this.value'>
<OPTION value='' selected>Select a client...
<%While Not RS1.EOF%>
<OPTION value="<%=trim(RS1("ClientID")%>">
<%=trim(RS1("Name")%>
<%
RS1.MoveNext
Wend
RS1.Close
Set RS1=Nothing
'Conn1.Close
%>
</select>
</td>
</tr>
<tr>
<TD>Contact:</td>
<td bgcolor='f0f0f0'><iframe id="iframe1" name='iframe1' FRAMEBORDER=0 SCROLLING='no' HEIGHT=40></iframe></td>
</tr>
</table>
/////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
getcontacts.asp
<body style="background:#f0f0f0 none" leftmargin=0>
<!-- <% response.write("The passed variable is: " & request("ClientID" )%> -->
<!-- METADATA Type="TypeLib" File="c:\program files\common files\system\ado\msado15.dll" -->
<form name="form2">
<!-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<!-- Used with Project Data Sheets -->
<!-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<%
set dbCon=Server.CreateObject("ADODB.Connection"
set MyCommand = Server.CreateObject("ADODB.Command"
dbCon.Open "Provider=SQLOLEDB;Integrated Security=SSPI;Initial Catalog=nnn;Data Source=nnnn"
MyCommand.ActiveConnection=dbCon
MyCommand.CommandType=adCmdStoredProc
MyCommand.CommandText = "asp_spPDataSheetContacts"
MyCommand.Parameters.Append MyCommand.CreateParameter("@inpClientID", adChar, adParamInput, 32, request("ClientID")
set rs = MyCommand.Execute
if not rs.eof then
response.write "<select name='contact'>"
while not rs.EOF
response.write "<option value='" & trim(rs("ContactID")& "'>" & trim(rs("ContactFullName")
rs.MoveNext
wend
response.write "</select>"
rs.close
set rs=nothing
end if
%>
</form>
</body>
Here's my problem. I have an ASP page using VBScript and JavaScript and reading SQL Server 2000 database.
I want to display client and contact information on my webpage based on which 1)Client is selected and then 2) which contact for that client is selected.
SELECTION 1
===========
Client A
Client B
etc...
if Client A is selected then read from the DB and retrieve all of the Contacts for Client A and display in another dropdown selection list.
SELECTION 2
Contact 1
Contact 2
etc... for (Selected - Client A)
Once the contact is selected from SELECTION 2 then
display addresses, phone numbers etc...
I would like to populate text boxes that have already been
defined on default.asp but I just can't seem to figure it out.
I have managed to get the Contacts populated into a dynamic dropdown selection box using an inline form but I can't figure out how to get the other information.
<%@ LANGUAGE="VBScript" %>
<!-- METADATA Type="TypeLib" File="c:\program files\common files\system\ado\msado15.dll" -->
<!--#include virtual="/projects/project/IASUtil.asp"-->
<%
Set Conn1=Server.CreateObject("ADODB.Connection"
Conn1.Open "Provider=SQLOLEDB;Integrated Security=SSPI;Initial Catalog=nnn;Data Source=nnn"
Set RS1=Conn1.Execute("asp_spProjectDataSheet"
%>
<SCRIPT language="JavaScript1.2">
function getIframe()
{
document.form1.contact.value=parent.iframe1.document.form2.elements[0].value;
}
</script>
<TABLE border="0" cellspacing="0" bgcolor='f0f0f0' width="100%">
<tr>
<TD>CLient: </td>
<td>
<select name="nclient" style="Width:200" onchange='loaddetail(this.value);document.getElementById("iframe1".src="getcontacts.asp?ClientID="+ this.value'>
<OPTION value='' selected>Select a client...
<%While Not RS1.EOF%>
<OPTION value="<%=trim(RS1("ClientID")%>">
<%=trim(RS1("Name")%>
<%
RS1.MoveNext
Wend
RS1.Close
Set RS1=Nothing
'Conn1.Close
%>
</select>
</td>
</tr>
<tr>
<TD>Contact:</td>
<td bgcolor='f0f0f0'><iframe id="iframe1" name='iframe1' FRAMEBORDER=0 SCROLLING='no' HEIGHT=40></iframe></td>
</tr>
</table>
/////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
getcontacts.asp
<body style="background:#f0f0f0 none" leftmargin=0>
<!-- <% response.write("The passed variable is: " & request("ClientID" )%> -->
<!-- METADATA Type="TypeLib" File="c:\program files\common files\system\ado\msado15.dll" -->
<form name="form2">
<!-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<!-- Used with Project Data Sheets -->
<!-- ////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<%
set dbCon=Server.CreateObject("ADODB.Connection"
set MyCommand = Server.CreateObject("ADODB.Command"
dbCon.Open "Provider=SQLOLEDB;Integrated Security=SSPI;Initial Catalog=nnn;Data Source=nnnn"
MyCommand.ActiveConnection=dbCon
MyCommand.CommandType=adCmdStoredProc
MyCommand.CommandText = "asp_spPDataSheetContacts"
MyCommand.Parameters.Append MyCommand.CreateParameter("@inpClientID", adChar, adParamInput, 32, request("ClientID")
set rs = MyCommand.Execute
if not rs.eof then
response.write "<select name='contact'>"
while not rs.EOF
response.write "<option value='" & trim(rs("ContactID")& "'>" & trim(rs("ContactFullName")
rs.MoveNext
wend
response.write "</select>"
rs.close
set rs=nothing
end if
%>
</form>
</body>