Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset hyperlinking question

Status
Not open for further replies.

garp2100

MIS
Oct 20, 2006
15
US
Hello everyone, I'm working with a database link in ASP, I've managed to hyperlink the field for "website" so clients can click on it once it appears in the site. Now, the way I have it, when you click on it it puts my domain in front and then the website ( which obviously doesn't go anywhere. Any ideas? the websites are stored in format in the database. Here's the piece of code I'm talking about. How can I program it so the code doesn't put my domain in front of the links?

<a href="<%=(rsWeighStations.Fields.Item("Website").Value)%>" class="main"><%=(rsWeighStations.Fields.Item("Website").Value)%></a>
 
It should not put in your domain unless that is what you have in the database field. To be certain, I would do a response.write of your rsWeighStations.Fields.Item("Website").Value and see what it prints. My guess is that you will find it holds your domain information as well as your external link.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Actually, the browser will generally concatenate the current folder/site you are visiting to the URL if it does not have an http:// in front of it (the browser assumes that it is supposed to be a relative URL not an absolute one).

Drop an HTTP:// in the front of your href and the problem should be solved (until someone enters and address with the http into the database :p)

Best MS KB Ever:
 
Interesting, Tarwn. I'd never encountered that behaviour before... But then again, I do tend to preface my URL's with the HTTP:// so maybe that's why... Off to test...

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Thank you Tarwn and Chopstick for your fast responses! actually, I implemented Tarwn response as soon as finished writing the thread, I put the http:// in all websites within the database (luckily there were only 8 out of 99 records or so) but thanks for the insight, and also the programmatic solution may come handy one day!

Best
Garp2100
 
oh I just noticed Tarwn's link to the microsoft KB, sorry, I did my best to state everything clearly and tried to be as specific as possible avoiding any rudeness or things like "HELP!!!", well thanks for that tip too! you live and you learn...
 
That wasn't specifically directed to you garp2100 ... it is Tarwn signature line.
 
Sorry about that, I guess I need to go back and put a real signature in there again at some point :) I took my active one out a few months ago because it was getting stale, didn't realize people might think I was referring them to that KB Article each time I posted...wonder how many people I have pissed off so far :p

Best MS KB Ever:
 
No worries Tarwn! you were quite helpful and I'm kinda of a novice so it never hurts to have extra info on etiquette!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top