|
 |
asp_databases thread: Link from a recordset list
Message #1 by "Paul Cracknell" <paul.cracknell@b...> on Mon, 19 Nov 2001 19:47:22
|
|
From a list of items produced by a recordset, I would like to offer the
user an opportunity of selecting and viewing one of the items listed in
greater detail.
At present I provide a text box into which the user types the ID number of
the entry and then submits the form using the 'post' method and the result
is displayed in the response page.
Does anyone know of a way that I can provide the selection by clicking on
the lined entry or part of the line.
I suspect that what I want cannot be done, but I thought it worth asking.
Thanks
Paul
Message #2 by Kyle Burns <kburns@c...> on Mon, 19 Nov 2001 14:51:42 -0500
|
|
All you need to do is place a link in each line to the detail page.
Something like this:
<TABLE>
<TR>
<TH>Name</TH>
<TH>Other Field</TH>
</TR>
<%
Do Until rs.EOF
%>
<TR>
<TD><A HREF="details.asp?id=<% =rs("ItemID") %>"><%
=rs("Name") %></TD>
<TD><% =rs("OtherField") %></TD>
</TR>
<%
rs.MoveNext
Loop
%>
</TABLE>
If you don't want a querystring, then you could use the same idea, but have
a form for each row with a hidden field containing the PK of the recordset
and a submit button that says "View Detail".
=================================
Kyle M. Burns, MCSD, MCT
ECommerce Technology Manager
Centra Credit Union
kburns@c...
-----Original Message-----
From: Paul Cracknell [mailto:paul.cracknell@b...]
Sent: Monday, November 19, 2001 2:47 PM
To: ASP Databases
Subject: [asp_databases] Link from a recordset list
From a list of items produced by a recordset, I would like to offer the
user an opportunity of selecting and viewing one of the items listed in
greater detail.
At present I provide a text box into which the user types the ID number of
the entry and then submits the form using the 'post' method and the result
is displayed in the response page.
Does anyone know of a way that I can provide the selection by clicking on
the lined entry or part of the line.
I suspect that what I want cannot be done, but I thought it worth asking.
Thanks
Paul
$subst('Email.Unsub')
Message #3 by Colin.Montgomery@C... on Mon, 19 Nov 2001 19:57:59 -0000
|
|
1. why not make each of your items act like a hyperlink to the detail page,
adding the ID field to the querystring so it can determine which one to
show.
2. use DHTML. Place the detail for each record in a table in the row below
and have an onClick event hide/unhide the table (or the <tr>). This will
mean sending more data in the first instance so the page may be slower, but
not that much.
HTH,
Colin
-----Original Message-----
From: Paul Cracknell [mailto:paul.cracknell@b...]
Sent: 19 November 2001 19:47
To: ASP Databases
Subject: [asp_databases] Link from a recordset list
From a list of items produced by a recordset, I would like to offer the
user an opportunity of selecting and viewing one of the items listed in
greater detail.
At present I provide a text box into which the user types the ID number of
the entry and then submits the form using the 'post' method and the result
is displayed in the response page.
Does anyone know of a way that I can provide the selection by clicking on
the lined entry or part of the line.
I suspect that what I want cannot be done, but I thought it worth asking.
Thanks
Paul
colin.montgomery@c...
$subst('Email.Unsub')
*******
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the
intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are
not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.
For further information about Clifford Chance please see our website at http://www.cliffordchance.com or refer to any Clifford
Chance office.
Message #4 by Imar Spaanjaars <Imar@S...> on Mon, 19 Nov 2001 20:57:59 +0100
|
|
Hi Paul,
This can certainly be done, and it's quite simple.
Append the ID of the record in the database to the URL you are linking to,
and use Request.QueryString to retrieve it in the detailpage.
Here is a small example:
listPage.asp
do while not rsRecordset.EOF
Response.Write("<a href=""viewDetails.asp?ID=" & rsRecordset("ID")
& """>" & rsRecordset("Description") & "</a><br />")
rsRecordset.MoveNext()
Loop
Then in the detailspage, retrieve the ID, and do a lookup in the database
for the details:
viewDetails.asp
Dim iID
iID = Request.QueryString("ID") & ""
If Len(iID) > 0 then
' An ID was provided
' More checking for valid ID here....
' Retrieve the recordset based on the ID here.
sSQL = "SELECT ID, Description, FullDetails Etc etc FROM
tblMyTable WHERE ID = " & iID
' Execute SQL command to get the data
end if
Lookup "QueryString" in the MSDN for more info, or let me know if you need
more info / help on this.
HtH
Imar
At 07:47 PM 11/19/2001 +0000, you wrote:
> From a list of items produced by a recordset, I would like to offer the
>user an opportunity of selecting and viewing one of the items listed in
>greater detail.
>
>At present I provide a text box into which the user types the ID number of
>the entry and then submits the form using the 'post' method and the result
>is displayed in the response page.
>
>Does anyone know of a way that I can provide the selection by clicking on
>the lined entry or part of the line.
>
>I suspect that what I want cannot be done, but I thought it worth asking.
>
>Thanks
>
>Paul
Message #5 by "Drew, Ron" <RDrew@B...> on Mon, 19 Nov 2001 17:52:37 -0500
|
|
<%
idfield="YourID"
scriptresponder="Your.asp"
howmanyfields=rstemp.fields.count -1
%>
<table align="center" border="1">
<tr>
<td valign="top"> </td>
<% 'Put Headings On The Table of Field Names
for i=0 to howmanyfields %>
<td align=center><b><%=rstemp(i).name %></b></td>
<% next %>
</tr>
<% ' Now lets grab all the records
do while not rstemp.eof %>
<tr><td valign="top">
<%my_link=scriptresponder & "?which=" & rstemp(idfield)%>
<a HREF="<%=my_link%>">View</a></td>
<% for i = 0 to howmanyfields%>
<td valign="top"><%=rstemp(i)%></td>
<% next %>
</tr>
<%
rstemp.movenext
loop
-----Original Message-----
From: Imar Spaanjaars [mailto:Imar@S...]
Sent: Monday, November 19, 2001 2:58 PM
To: ASP Databases
Subject: [asp_databases] Re: Link from a recordset list
Hi Paul,
This can certainly be done, and it's quite simple.
Append the ID of the record in the database to the URL you are linking to,
and use Request.QueryString to retrieve it in the detailpage.
Here is a small example:
listPage.asp
do while not rsRecordset.EOF
Response.Write("<a href=""viewDetails.asp?ID=" & rsRecordset("ID")
& """>" & rsRecordset("Description") & "</a><br />")
rsRecordset.MoveNext()
Loop
Then in the detailspage, retrieve the ID, and do a lookup in the database
for the details:
viewDetails.asp
Dim iID
iID = Request.QueryString("ID") & ""
If Len(iID) > 0 then
' An ID was provided
' More checking for valid ID here....
' Retrieve the recordset based on the ID here.
sSQL = "SELECT ID, Description, FullDetails Etc etc FROM
tblMyTable WHERE ID = " & iID
' Execute SQL command to get the data
end if
Lookup "QueryString" in the MSDN for more info, or let me know if you need
more info / help on this.
HtH
Imar
At 07:47 PM 11/19/2001 +0000, you wrote:
> From a list of items produced by a recordset, I would like to offer
>the user an opportunity of selecting and viewing one of the items
>listed in greater detail.
>
>At present I provide a text box into which the user types the ID number
>of the entry and then submits the form using the 'post' method and the
>result is displayed in the response page.
>
>Does anyone know of a way that I can provide the selection by clicking
>on the lined entry or part of the line.
>
>I suspect that what I want cannot be done, but I thought it worth
>asking.
>
>Thanks
>
>Paul
---
You are currently subscribed to asp_databases as: RDrew@B... To
unsubscribe send a blank email to $subst('Email.Unsub')
|
|
 |