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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hyperlink question 1

Status
Not open for further replies.

sera

Technical User
Jun 29, 2000
360
0
0
US
Yep it is again a different question. I have a field that is a hyperlink in an Access table. When I retrieve the data and display it on the html page I get something that looks like this...

#X:\alaska_pdf\somefile.pdf#

I would really like this to display as a hyperlink so the user can open the document that corresponds to the record. Anyone know how to do this?

Thanks,
Sera
 
[tt]First create a recordset to your navigation table and when displaying the contents you want to something like this

For example in my table I have two fields

[ol][li]The Navigaition Link[/li] [li]Navigation Name[/li][/ol]

<A href=&quot;<%=(rsNavigate.Fields.Item(&quot;nav_link&quot;).Value)%>&quot;><%=(rsNavigate.Fields.Item(&quot;nav_name&quot;).Value)%></A>


[tt]&quot;A Successful man is one who can build a firm foundation with the bricks that others throw at him&quot;[/tt]
[noevil]
 
Sera,

I am having the same issue. Did you use Tony's suggestion?

I am a new comer to Active Server Pages and cannot understand his explanation.

How did you solve the problem?

Cheers

Vic...
 
[tt]What part are you having problems with Vic?
[tt]&quot;A Successful man is one who can build
a firm foundation with the bricks
that others throw at him&quot;
[/tt]

star.gif
star.gif
star.gif
star.gif

 
Well Vic,
I actually ended up using this code:

Do Until rs.EOF
For Each Item in rs.fields
response.write &quot;<a href = &quot; + rs.fields(2) + &quot; target = '_blank'&quot;+ &quot;>&quot; + rs.fields(2)+ &quot; </a> &quot;
Next
rs.movenext
Loop


I never could get Tony's to work. Basically what I am doing here is:

rs is a recordset that is built using a query. I am using the array like properties of a recordset. I know that my URL is in the third field of the recordset. The array indexing starts at zero, so the third field is accessed using rs.fields(2). I am just concatenating the rs.fields(2) with the a href tag. Ask if you need further clarification. Hope this helps!


Sera
I often believe that...
My computer is possessed!
 
[tt]
Vic, I'll try explain myself in plain english...
.. here we go.


1. We all know this is a link right?
<a href=&quot;&quot;>I'm a link</a>


Here a database link
Using the same basics, except we're using variable field in a database.

Match the colors to see what I mean


<a href=&quot;<%=(rsNavigation.Fields.Item(&quot;Navigation_link&quot;).Value)%>&quot; title=&quot;<%=(rsNavigation.Fields.Item(&quot;Navigation_desc&quot;).Value)%>&quot;><%=(rsNavigation.Fields.Item(&quot;Navigation_name&quot;).Value)%></a></p>

The RED is simply the description the mouse shows when hover over the link.

Hope it help...
[tt]&quot;A Successful man is one who can build
a firm foundation with the bricks
that others throw at him&quot;
[/tt]

star.gif
star.gif
star.gif
star.gif

 
I am also having similar problems.

In my Access Database there is a table (items) with a column(description). Each items' description inludes a separate hyperlink (Item 1's description is item 2 is
My .asp code is:

<%
Dim rsItem, strItemName, strDescription
Set rsItem = Server.CreateObject(&quot;ADODB.Recordset&quot;)
strSQL = &quot;SELECT * FROM Item WHERE ItemID =&quot; & Request(&quot;Item&quot;)
rsItem.Open strSQL, objConn
strItemName = rsItem(&quot;ItemName&quot;)
strDescription = rsItem(&quot;Description&quot;)
.
.
.
<TD>Item:</TD>
<TD><%= strItemName %></TD>
</TR>
<TR>
<TD>Description:</TD>
<TD><%= strDescription %></TD>
</TR>

Not to sound like a complete idiot, or a complete jerk, what do I neet to change so that I dont get teh same output as the original poster (#
Thank you, in advance, for any responces
 
[tt]
From what I see, all you need it to loop thru your table and use this logic:


Static Link:
<a href=&quot;&quot;>I'm a link</a>




Variable Link
<a href=&quot;<%=(rsNavigation.Fields.Item(&quot;Navigation_link&quot;).Value)%>&quot; title=&quot;&quot;><%=(rsNavigation.Fields.Item(&quot;Navigation_name&quot;).Value)%></a>
[tt]&quot;A Successful man is one who can build
a firm foundation with the bricks
that others throw at him&quot;
[/tt]

banana.gif
rockband.gif
banana.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top