Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-15-2005, 09:04 AM   PM User | #1
VMM
New Coder

 
Join Date: Jul 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
VMM is an unknown quantity at this point
printing data from db as a link

Hello,

I have asp program that reads information from the database and print the information to the table on a web page.

The reading happens trough a normal "do while not EOF" loop.

I have tried to make each data to a link. I mean that when the data is printed to the table, the program would also put a link to each data. When the user selects the link in the table, the program gets all of the information from the DB based on what link did the user pushed.

For example: the program gets different car marks from the db and then prints them out into a table. every mark in the table is also a link. When the user selects, for example a Toyota, the web page gets all the toyotas from the db and prints them out.

It feels like a simple problem but still I havent found a way to solve it. If somebody can give me a hint how I should proceed, please tell me.

Thank you for advance.
VMM is offline   Reply With Quote
Old 08-15-2005, 12:07 PM   PM User | #2
Cyberlord
New Coder

 
Join Date: Aug 2005
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Cyberlord is an unknown quantity at this point
Hello,

try this:

Code:
<%
carid = request.querystring("carid")
carmark = request.querystring("carmark")
If LEN(carid) > 0 Then
select * FROM carlist where carid = '"& carid &"'"
table for car-details......
Else
If LEN(carmark) > 0 Then
 select * FROM carlist where carid = '"& carid &"'"
Else
 select * FROM carlist"
End If
%>
<tr><th>Car</th><th>Mark</th></tr>
<% Do While NOT RS.EOF %>
<tr><td><a href="cars.asp?carid=<%= RS("carid") %>">Fiat Panda</a></td><td><a href="cars.asp?mark=<%= RS("carmark") %>">Fiat</a></td></tr>
<% RS.Movenext
Loop

End If %>
__________________
ASP-FastBoard

www.cyberlord.at
Cyberlord is offline   Reply With Quote
Old 08-18-2005, 08:59 AM   PM User | #3
VMM
New Coder

 
Join Date: Jul 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
VMM is an unknown quantity at this point
Thank you Cyberlord. Your example was perfect. It worked very well.
VMM is offline   Reply With Quote
Old 08-22-2005, 03:10 AM   PM User | #4
Bullschmidt
Regular Coder

 
Join Date: Aug 2002
Location: USA
Posts: 478
Thanks: 0
Thanked 2 Times in 2 Posts
Bullschmidt is an unknown quantity at this point
And to open in a new window (if you ever want to do that) you could change this:

<a href="cars.asp?carid=<%= RS("carid") %>"><%= RS("carname") %></a>

To be more like this instead:

<a href="cars.asp?carid=<%= RS("carid") %>" target="new"><%= RS("carname") %></a>
__________________
J. Paul Schmidt
www.Bullschmidt.com - Freelance Web and Database Developer
www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips
Bullschmidt is offline   Reply With Quote
Old 08-22-2005, 12:31 PM   PM User | #5
Cyberlord
New Coder

 
Join Date: Aug 2005
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Cyberlord is an unknown quantity at this point
You can improve that:

... target="cars" onclick="window.open('','cars','menubar=no,scrollbars=yes,status=no,width=550,height=580,left='+ (screen.width-550)/2 +',top='+ (screen.height-580)/2 +'')">...
__________________
ASP-FastBoard

www.cyberlord.at
Cyberlord is offline   Reply With Quote
Old 08-22-2005, 01:16 PM   PM User | #6
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Code:
<a href="cars.asp?carid=<%= RS("carid") %>" target="cars" onclick="window.open(this.href,this.target,'menubar=no,scrollbars=yes,status=no,width=550,height=580,left='+ (screen.width-550)/2 +',top='+ (screen.height-580)/2 +'').focus();return false;">
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 08-22-2005, 01:55 PM   PM User | #7
Cyberlord
New Coder

 
Join Date: Aug 2005
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Cyberlord is an unknown quantity at this point
You dont need to specify the url again, because i have set the target by name (cars), but i think your code should also be okay.

cheers
__________________
ASP-FastBoard

www.cyberlord.at
Cyberlord is offline   Reply With Quote
Old 08-22-2005, 03:12 PM   PM User | #8
ghell
Senior Coder

 
Join Date: Apr 2003
Location: England
Posts: 1,192
Thanks: 5
Thanked 13 Times in 13 Posts
ghell is on a distinguished road
Quote:
Originally Posted by Bullschmidt
And to open in a new window (if you ever want to do that) you could change this:

<a href="cars.asp?carid=<%= RS("carid") %>"><%= RS("carname") %></a>

To be more like this instead:

<a href="cars.asp?carid=<%= RS("carid") %>" target="new"><%= RS("carname") %></a>
i thought tht was sposed to be target="_blank"

if you want all links on a page to open in a new window u can also do <base target="_blank"> in the head section.. just thought id mention that since no1 ever uses <base> even though it can be prety useful
__________________
My tech/code blog
ghell is offline   Reply With Quote
Old 08-22-2005, 07:49 PM   PM User | #9
Bullschmidt
Regular Coder

 
Join Date: Aug 2002
Location: USA
Posts: 478
Thanks: 0
Thanked 2 Times in 2 Posts
Bullschmidt is an unknown quantity at this point
Quote:
i thought tht was sposed to be target="_blank"
_blank is used a lot but a user-defined name is also allowed.

Sometimes I like to use a different user-defined name so that it will be sure to open in a new window (so that the focus is sure to move to there) instead of one that has already been opened (just a matter of preference I suppose).

And good point about base...
__________________
J. Paul Schmidt
www.Bullschmidt.com - Freelance Web and Database Developer
www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips
Bullschmidt is offline   Reply With Quote
Old 08-23-2005, 05:24 AM   PM User | #10
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Quote:
Originally Posted by Bullschmidt
Sometimes I like to use a different user-defined name so that it will be sure to open in a new window (so that the focus is sure to move to there)
For user-defined window target name (and if the window with that name is already opened), focus is only set if you explicitly call the focus() method. Unlike in _blank where the focus is always set to the newly opened window even without calling focus() method.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 08-23-2005, 05:46 AM   PM User | #11
Bullschmidt
Regular Coder

 
Join Date: Aug 2002
Location: USA
Posts: 478
Thanks: 0
Thanked 2 Times in 2 Posts
Bullschmidt is an unknown quantity at this point
Will have to play/test that a little - thanks for the info Glenn!
__________________
J. Paul Schmidt
www.Bullschmidt.com - Freelance Web and Database Developer
www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

Last edited by Bullschmidt; 08-23-2005 at 05:48 AM..
Bullschmidt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:37 PM.


Advertisement
Log in to turn off these ads.