Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / February 2007



Tip: Looking for answers? Try searching our database.

Images and links

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ricardo Furtado - 01 Feb 2007 14:31 GMT
i'm developing a web site in asp .net but i came up with a rookie problem.
How can i insert an image or a link from a database record?
I'm using a table and inside the table i have the following code:

<td><img alt=""  src=<%DR("Image").ToString()%> width="78px" height="78px">
</td>

<td><a href=<% "viewarticle.aspx " & DR("IdArticle").ToString()%>>.</a>
</td>

which are invalid instructions. How can i define the src and href for the
image and the link?

My thanks in advanced

Ricardo Furtado
Anthony Jones - 01 Feb 2007 14:35 GMT
> i'm developing a web site in asp .net but i came up with a rookie problem.
> How can i insert an image or a link from a database record?
[quoted text clipped - 8 lines]
> which are invalid instructions. How can i define the src and href for the
> image and the link?

Try <%="viewarticle.aspx " & DR("IdArticle").ToString()%>

For future refrence this Group is for Asp classic not ASP.NET

> My thanks in advanced
>
> Ricardo Furtado
Daniel Crichton - 01 Feb 2007 14:39 GMT
Ricardo wrote  on Thu, 1 Feb 2007 06:31:00 -0800:

> i'm developing a web site in asp .net but i came up with a rookie problem.
> How can i insert an image or a link from a database record?

This isn't an ASP.Net newsgroup, it's for classic ASP. You need to post into
one of the groups with dotnet in the name. I'll see if I can help though.

> I'm using a table and inside the table i have the following code:
>
> <td><img alt=""  src=<%DR("Image").ToString()%> width="78px"
> height="78px"> </td>

You're missing the =, which is the shortcut for Response.Write in ASP (I
guess it's the same in ASP.Net). And you're missing the quotes around the
image link (although most browsers will handle that). Try this.

<td><img alt=""  src="<%=DR("Image").ToString()%>" width="78px"
height="78px"> </td>

> <td><a href=<% "viewarticle.aspx " & DR("IdArticle").ToString()%>>.</a>
> </td>

Again, no =. You can do it either of these ways:

<td><a href=<%= "viewarticle.aspx " & DR("IdArticle").ToString()%>>.</a>
</td>

or

<td><a href="viewarticle.aspx <%=DR("IdArticle").ToString()%>">.</a>
</td>

However, these are both going to give invalid URLs as you've just put a
space between the aspx URL and the id. Maybe you wanted this:

<td><a href="viewarticle.aspx?id=<%=DR("IdArticle").ToString()%>">.</a>
</td>

where the viewarticle page reads the "id" querystring value to get the
article id. Replace with the appropriate parameter name.

> which are invalid instructions. How can i define the src and href for the
> image and the link?

Hopefully the above will help.

Dan
Ricardo Furtado - 01 Feb 2007 15:53 GMT
Yes, its working now.
the ' and = were missing in <%DR("Image").ToString()%>
the following instruction is the correct one
'<%=DR("Image").ToString()%>'

thank you very much

Ricardo Furtado

> Ricardo wrote  on Thu, 1 Feb 2007 06:31:00 -0800:
>
[quoted text clipped - 44 lines]
>
> Dan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.