Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
string ImageFile = itm.ProductImageURL.ToString();

//ImageFile vaue is "C:\Users\Public\Pictures\Sample Pictures\logo1.png"
//this is a local path , i want to show an image from local drive ,this image not in my running project. only path is in database.

XML
<a href="/ProductList/ProductDetails/@itm.Id">
                            <img src="@ImageFile " class="img-responsive" alt="Berry Lace Dress"></a>
Posted
Updated 3-Nov-14 4:05am
v4

1 solution

Wrong, not every one would have the image in their C drive. However, running an image from local storage doesn't have any trouble, you just need to write the write the correct location for the image.

Try this code,

C#
<img src="@ImageFile " class="img-responsive" alt="Berry Lace Dress">
</img>


In ASP.NET you use server-side variables by prefixing the variable name with a @ in your HTML markup.
 
Share this answer
 
Comments
Manas Bhardwaj 3-Nov-14 9:58am    
yes +5!
Afzaal Ahmad Zeeshan 3-Nov-14 10:00am    
Thanks a lot Manas brother. :-)

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