|
 |
asp_web_howto thread: Using value from parent window as criteria in SQL statement in pop-up window
Message #1 by constancebeckett@h... on Mon, 24 Mar 2003 19:03:57
|
|
Hi
How do I use a value from a text box within the parent window as criteria
in the SQL statement in a pop-up window?
Parent window:-
<script language=javascript>
function selectcontact()
{
if (document.AddRFQ.Company.value>0)
{
var CurrentHeight = (window.screen.availHeight/4)*2;
var CurrentWidth = window.screen.availWidth/3;
formsubmit='F620_Select_Contact.asp';
window.open
(formsubmit, 'new_window','width='+CurrentWidth+',height='+CurrentHeight+'
,left=25, top=25, scrollbars=yes,resizable=yes');
}
else
alert("You need to select a customer before you can
select a contact.");
}
</script>
Pop-Up window:-
Set rsCont = Server.CreateObject("ADODB.RecordSet")
sqlCont ="SELECT tblCoContact.CoContID, tblCoContact.email,
[LName] & ' ' & [FNAME] & ' ' & [SALUTE] AS ContactName " &_
"FROM tblCoContact " &_
"WHERE (((tblCoContact.CompID)=1443)) " &_
"ORDER BY tblCoContact.LName, tblCoContact.FName,
tblCoContact.Salute;"
rsCont.ActiveConnection = con2
rsCont.Source=sqlCont
rsCont.CursorType = 3
rsCont.CursorLocation = 3
rsCont.LockType = 3
rsCont.Open()
I need to replace the hard coded number (1443) with the value from the
opening window.
Thanks
Connie
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 25 Mar 2003 18:03:27 +1100
|
|
You need to pass it in the querystring.
function windowOpen(contactID) {
NewWindow=window.open('myPopUpPage.asp?ContactID=' + contactID, ...other
stuff
}
where contactID comes from your select list. In your pop-up page you can get
the ContactID via Request.QueryString("ContactID")
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: <constancebeckett@h...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Monday, March 24, 2003 7:03 PM
Subject: [asp_web_howto] Using value from parent window as criteria in SQL
statement in pop-up window
: Hi
: How do I use a value from a text box within the parent window as criteria
: in the SQL statement in a pop-up window?
:
: Parent window:-
: <script language=javascript>
: function selectcontact()
: {
: if (document.AddRFQ.Company.value>0)
: {
: var CurrentHeight = (window.screen.availHeight/4)*2;
: var CurrentWidth = window.screen.availWidth/3;
: formsubmit='F620_Select_Contact.asp';
: window.open
: (formsubmit, 'new_window','width='+CurrentWidth+',height='+CurrentHeight+'
: ,left=25, top=25, scrollbars=yes,resizable=yes');
: }
: else
: alert("You need to select a customer before you can
: select a contact.");
: }
: </script>
:
: Pop-Up window:-
:
: Set rsCont = Server.CreateObject("ADODB.RecordSet")
: sqlCont ="SELECT tblCoContact.CoContID, tblCoContact.email,
: [LName] & ' ' & [FNAME] & ' ' & [SALUTE] AS ContactName " &_
: "FROM tblCoContact " &_
: "WHERE (((tblCoContact.CompID)=1443)) " &_
: "ORDER BY tblCoContact.LName, tblCoContact.FName,
: tblCoContact.Salute;"
: rsCont.ActiveConnection = con2
: rsCont.Source=sqlCont
: rsCont.CursorType = 3
: rsCont.CursorLocation = 3
: rsCont.LockType = 3
: rsCont.Open()
:
:
: I need to replace the hard coded number (1443) with the value from the
: opening window.
: Thanks
: Connie
:
:
|
|
 |