Click here to Skip to main content
15,905,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have an anchor tag like this
HTML
<a href="path"></a>

Also i have image path string upload/imagename.jpg in my sql server.Can anyone tell me how to place image path string from database onto anchor tag in place of 'path'.please help me.god bless you

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 29-Jan-14 0:50am
v3

This is how I do it: A generic Image-From-DB class for ASP.NET[^]


"think you did'nt get my question. i meant i have to place image path string from database onto href part of anchor tag.Suppose if i have string big upload/energy3.jpg' in my sql server on compiling anchor tag should have image string on its href part"

Ah! Well, you should have said...:laugh:
Add the ID and RUNAT attributes to your href:

ASP.NET
<a id="MyLink" runat="server" href="">Linky!</a>

Then set the link from the C#:
C#
MyLink.HRef = "http:www.MyDomain.com/Images/myImage.jpg";
 
Share this answer
 
v2
Comments
faizel s 29-Jan-14 6:45am    
i think you did'nt get my question. i meant i have to place image path string from database onto href part of anchor tag.Suppose if i have string big upload/energy3.jpg' in my sql server on compiling anchor tag should have image string on its href part
Solution suggested above by OriginalGriff' is OK for configuring anchor tag separately.. but if you are trying to configure tag in data control like grid then just bind href attribute to expected field from dtat base.

some thing like this..
C#
<a id="MyLink"  runat="server" href="<%# DataBinder.Eval(Container.DataItem, "ImageUrl") %>">Linky!</a>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900