"Chris Anderson" wrote:
: On Sun, 15 Feb 2004 05:02:07 -0600, "Roland Hall" <nobody@nowhere >
: wrote:
:
: >"Chris Anderson" wrote:
: >: Hi All.
: >:
: >: I have an ASP page that has over 150 records listed. I would like to
: >: have an "Index" (A,B,C,D...) at the very top of the page.
: >: Once a letter is clicked, I need to:
: >: 1) Call a SQL string like "SELECT * from WoD Where UCASE(WotD) LIKE "
: >: & UCASE(strSelect ed) & "*" & Chr(34)
: >:
: >: 2) Recall the SAME page (Not another ASP page) withpopulating with the
: >: new recordset.
: >
: >Something like this?
: >
: >
http://kiddanger.com/lab/spandex.asp
:
: This would be the index part, yes.
: Although this appears to be Javascript and I am using vbscript.
:
: But how whould I call the same page back with the new SQL statement?
This is VBScript on the server side and DHTML on the client side. VBScript
doesn't support events. If you're using IE, which is the only browser that
supports VBScript on the client side, then this will work just fine.
This is the server side:
if Request.QuerySt ring("ndx") <> "" Then
Response.Write( "<div id=""ndx"">You chose " & Request.QuerySt ring("ndx") &
"</div>")
end if
The client side passes the index on the URL. The server side grabs it when
it reloads the page. Now that you have the index identified, you write your
server side code to make a connection to the server, grab the relevant data
by passing your SQL statement and then output the contents.
I wrote CSS to position the Index 5px down, 5px across. I positioned my
example to show the result below that. You would position your content in a
similar fashion. I suggest making a call to the server, grab the data with
rs.getrows(), create your loop, and in it, output your data.
<%
dim r, iCols, iRows, nCols, nRows, rThis
' make connection to db
' execute SQL statement and retrieve data in rs.getrows()
r = rs.getrows()
conn.close
set conn = nothing
set rs = nothing
' write FOR...NEXT loops and display data
nCols = ubound(r,1) ' number of columns
nRows = ubound(r,2) ' number of rows
for iRows = 0 to nRows
Response.Write( "<div class=""divRows "">)
for iCols = 0 to nCols
rThis = r(iCols, iRows)
Response.Write( "<span>" & rThis & "</span>")
next
Response.Write( "</div")
next
%>
I just jotted this down here so it is untested. The divRows class should
not have CSS positioning information. Put it in a container that has
positioning so you know where to start.
HTH...