File hyperlink ???

G

Guest

Dear all,

I am building an ASP 1.1 applciation collecting data from an SQL server
database.
In one table field, users will have possibility to introduced a file path
(attached document)

What I would like to do is to display in a datagrid column, a picture
visible when the File path column is not empty and that path is valid, and
then create an hyperlink on that picture pointing to the file.

I have try to use Template column but coucl not geit it work.
In fact my datgrid column should be bound to the "FILEPATH" field of my
database table but instead of displaying the content of the column, it should
display a pictture linked to the content of the field

thnaks for your help
regards
serge
 
A

andrew

I don't know if this is the "Proper" way to implemenet this but i
usally write a function in the code behind that is passed the FILEPATH
field as a parameter. The function checks the filepath field and if not
NULL (nothing) it returns a string that builds the image.

Public Function CheckForImage(ByVal s as string)
if s isnot nothing then
return "<img src='/images/image2display.gif'> <a href='" & s & "'>
DOWNLOAD </a>"
else
return ""
End if

Assuming s is the path to the file which is stored in the database.
Good luck.

If you wanted to right the code inside the script you could write a
fairly simple IIF statement.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctIIF.asp
 

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

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,121
Latest member
LowellMcGu
Top