 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 24th, 2004, 01:27 PM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hyperlink hyperlink
i am retreving my data from database(by using following code) with some fields(Prereq and CourseId)linked to other mypage.asp by using anchor tab.
now my problem is that my all records fetched would point to the same page..but i would like them to
link them to different pages....ex all the couserIDs i retreive should be linked with differnt pages and not the same page ,in my case its mypage.asp..
how shud i solve this problem?
response.write "<b>[u]Title: " & RS("title") & "</b></u><br><br>"
response.write "<b> " & RS("CoreType") & " </b><br>"
while not RS.eof
response.write " <a href='http://localhost/smita/mypage.asp'>" & RS("PreReq") & "</a> "
response.write " <a href='http://localhost/smita/mypage.asp'>" & RS("CourseId") & "</a> <br>"
response.write " " & RS("Description") & "<br><br>"
RS.movenext
wend
RS.close
Set RS = nothing
Set Con = nothing
|
|

August 24th, 2004, 08:20 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
|
|
hello,
what do you mean by different pages? I understand that every record from the database should have an anchor to different page but not to mypage.asp If so how many pages you had?
its not good way of doing like this. You can do with querystring...
while not rs.eof
response.write "<a href='mypage.asp?courseid=" & rs("courseid") & "'>" & rs("courseid") & "</a>"
rs.movenext
wend
like that you can pass different values throug querystring.
|
|

August 25th, 2004, 08:23 AM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi there,
wht i meant was for example..i have 5 records of my courses..say LEST 3002
LEST 6002
..
..
now when i put an hyperlink to each of the course...ex if user clicks on LEST 3002..i want it to go to another page which would give description of this course in detials,if user clikcs on LEST 6002 ,it shud give detials of this course...
Thats wht i want and dont know how i shud do it..
hope u understood my problem!
waiting for ur reply
|
|

August 25th, 2004, 09:05 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This is simple.
As Rajanikrishna told, you can pass the course name to a page as querystring and do it as below.
If the course deescription is static,
------------------------------------------
if Request.QueryString("courseid")="LEST 3002" then
Response.Write <course description of LEST 3002>
elseif Request.QueryString("courseid")="LEST 4002" then
Response.Write <course description of LEST 4002>
elseif Request.QueryString("courseid")="LEST 5002" then
Response.Write <course description of LEST 5002>
elseif Request.QueryString("courseid")="LEST 6002" then
Response.Write <course description of LEST 6002>
elseif Request.QueryString("courseid")="LEST 7002" then
Response.Write <course description of LEST 7002>
endif
-----------------------------------------------------------
If course description is in a table, you may either write a function to fetch the description from table. Possibly the description will be in the same table as the course name. Then you can write a single query like
select description from <course table> Where coursename='" & Replace(Request.QueryString("courseid"), "'", "''")) & "'"
Then print description.
|
|

August 25th, 2004, 12:41 PM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi madhu..
Well i dint get you....the thing i want is..i retreive these couse ids from data base by using a loop in my ASP codes..liek this:
while not RS.eof
response.write " & RS("CourseId") & " <br>"
response.write " " & RS("Description") & "<br><br>"
RS.movenext
wend
Now if for example my output with this looks like this:
L 122
L 223
now the person shud be able to click on L 122 and get a detials description of the course..same goes for other courses which gets displayed on the page.If i have around 100 courses like this..i can give a query string manaually for each course.Wht i want is i put this in a loop where i get them on my output page with different hyperlinks for each course...
Hope u are understanding my problem!!
|
|

August 26th, 2004, 01:33 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Do you want to display the deescription without refreshing the page ? i.e. when user clicks course 1, the corresponding description is shown at a specified place on the page. Then when you click the next course, the corresponding desc. is shown at the same place all this without refreshing the whole page.
You can use an Iframe to achieve this. First create a page which will just fetch the description. Then show that page in a IFrame. The target of the links of courses should be the name of IFrame.
|
|

August 26th, 2004, 02:04 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
If the information is comming from a data base a page refresh is required as it needs to get this information from the server.
You could use simple conditional statements within the <td> where you want to show the description, what ever id came via the QS get that description and show it...
Wind is your friend
Matt
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Hyperlink |
sryap3 |
Access VBA |
1 |
November 20th, 2008 04:25 PM |
| How we can use hyperlink |
nagham |
Crystal Reports |
0 |
February 9th, 2007 03:51 AM |
| hyperlink |
kritimehrotra |
Excel VBA |
3 |
July 24th, 2006 08:32 PM |
| hyperlink |
pab006 |
Classic ASP Basics |
5 |
December 17th, 2003 10:33 AM |
| Hyperlink |
viktor26 |
Classic ASP Basics |
0 |
October 19th, 2003 09:48 AM |
|
 |