Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Passinge variables to another ASP page


Message #1 by "Lloyd Levine" <levinll@m...> on Mon, 18 Sep 2000 17:09:44 +0100
I've created a HTML table from data extracted from a Access database, and

I want to create a link so that if the user clicks on a row, it will take

them to another page. I'm able to create the link, but when I try to set

up the variable portion of the link, I keep getting error messages.



If my field I'm trying to create a link for is referenced as

Table("field1") can't I just set up my link by the following:



Response.Write "<TR<TD><A HREF="test.asp"?Table("field1")>" & Table("field1" & " </A></TD>

Message #2 by "Ray Murphy" <raymondmurphy@c...> on Mon, 18 Sep 2000 20:57:13 +0100
Lloyd,



The following code snippet may be what you're after - it basically trawls

through the Recordset, formats the data from the database into an HTML 

table with column headers, formats the first column as a hyperlink to 

another page and allows that page to be called with some values being 

passed down (ie FirstParamVal and SecondParamVal) ......



<TABLE border=1 CELPADDING="2" CELLSPACING="0" WIDTH=75%>

<TR>

' Output the Column Headers ...

<%For intCol = 0 To objRS.Fields.Count - 1 %>

<TD nowrap bgcolor="#000060" valign="top">

<FONT FACE="helvetica,verdana,arial" SIZE=4 COLOR="#99cccc"><B>

<% = objRS.Fields(intCol).Name%></B></FONT>

</TD>

<%Next%>

</TR>

<%

Do While objRS.AbsolutePage = iPageCurrent And Not objRS.EOF

%>

<TR>

' Output the Data Values ...

<%For intCol = 0 To objRS.Fields.Count - 1%>

<TD nowrap bgcolor="<%=strColor%>">

<FONT FACE="helvetica,verdana,arial" SIZE="2" COLOR="BLUE">

<% If IsNull(objRS.Fields(intCol).Value) Then 

Response.Write " "

Else 

IF intcol = 0 THEN 'Make the first column a link to 

LinkedPage

'and pass down the first column and 

second column

'to LinkedPage in the querystring %>

<A 

HREF="LinkedPage.asp?FirstParamVal=<%=objRS.Fields(0)%>&SecondParamVal=<%=objRS.Fields(1)%>">

<%Response.Write objRS.Fields(intCol).Value & "</A>" 

Else 

Response.Write " " & objRS.Fields(intCol).Value

End If

End If

%></FONT>

</TD>

<%Next%>

</TR>

<%

objRS.MoveNext

Loop

%>

</TABLE>



Hope this helps.



Ray Murphy

Goldseal Computer Consultants

www.goldsealdata.com





Message #3 by "Asmadi Ahmad" <chloro@e...> on Tue, 19 Sep 2000 09:22:54 +0800
Lloyd,

I suggest u do something like this:



%><TR><TD><A HREF="test.asp?<%=Table("field1")%>"> <%=Table("field1") %>

nbsp;</A></TD><%



or



Response.Write "<TR><TD><A HREF=""test.asp?" &Table("field1") &""">" &

Table("field1") & "nbsp;</A></TD>"



I usually don't use  response.write for this type of link coz i always got

screwed up in the syntax part. So don't know whether the second statement

will work or not.



asmadi

www.effitech.com





----- Original Message -----

From: Lloyd Levine <levinll@m...>

To: ASP Databases <asp_databases@p...>

Sent: Tuesday, 19 September, 2000 12:09 AM

Subject: [asp_databases] Passinge variables to another ASP page





> I've created a HTML table from data extracted from a Access database, and

> I want to create a link so that if the user clicks on a row, it will take

> them to another page. I'm able to create the link, but when I try to set

> up the variable portion of the link, I keep getting error messages.

>

> If my field I'm trying to create a link for is referenced as

> Table("field1") can't I just set up my link by the following:

>

> Response.Write "<TR<TD><A HREF="test.asp"?Table("field1")>" &

Table("field1" & " </A></TD>

>




  Return to Index