ASP problem, ideas needed ;-)

A

Avlan

Hi all,

I'm pretty new at asp-coding, but I'm getting stuff to work.

I now have the problem that, after someone has made a query, returning,
say, 10 contacts (name/addresses in a simple table), I want the user to
be able to CLICK on one of the names in the list, and thus be
redirected to a new page where details about the selected user will be
available.

Now I've tried to create the last names as hyperlinks, which of course
works fine, but I now have the problem that the user is redirected to a
'details.asp'-page, but this way there is no way I can think of to find
out on which name the user has clicked.

Needless to say, I do not want to make a different asp-page for every
contact, but it has to be generated dynamically with the data in the
DB. But I want the user to click only once (not with radiobuttons or
post/get-buttons etc), on the name (or row) of the contact.

Any bright ideas? :)
 
E

Evertjan.

Avlan wrote on 11 feb 2006 in microsoft.public.inetserver.asp.general:
I'm pretty new at asp-coding, but I'm getting stuff to work.

I now have the problem that, after someone has made a query, returning,
say, 10 contacts (name/addresses in a simple table), I want the user to
be able to CLICK on one of the names in the list, and thus be
redirected to a new page where details about the selected user will be
available.

Now I've tried to create the last names as hyperlinks, which of course
works fine, but I now have the problem that the user is redirected to a
'details.asp'-page, but this way there is no way I can think of to find
out on which name the user has clicked.

Needless to say, I do not want to make a different asp-page for every
contact, but it has to be generated dynamically with the data in the
DB. But I want the user to click only once (not with radiobuttons or
post/get-buttons etc), on the name (or row) of the contact.

This is mainly an clientside problem:

<tr><td onclick='redir(this)'>myLastName</td></tr>

<script type='text/javascript'> // clientside!
function redir(x){
location.href='details.asp?r='+escape(x.innerHTML)
}
</script>

Not tested

======== details.asp ==========

<%

r = request.querystring("r")
' ......

%>
 
S

Simon O'Beirne

I would normally use (if there is one) a primary key to show the details,
just a bit cleaner :)

generate the hyperlink like:

<A HREF="details.asp?c=<%=clientId%>"><%=clientName%></A>

then just do like Evertjan said:

c = request.querystring("c")

in details.asp

Simon
 
A

Avlan

Yeh the thought came to me too, adding the parameters in the redirect..
:)

I just though that that was kind of a crude way to do it, and that
there would be some way to make a clickable link which (when clicked)
can send some info with the redirect, but apparently this is not
possible (or very hard)..

So thanks for the confirmation, apparently this is the way to go! It
works like a charm, so I'm happy anyway ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top