Click here to Skip to main content
16,016,712 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have grid view and in the template field of grid view i have image control
and this control bind from sql server database 2005
i retrieve this image from sql server database 2005 in the table image column have only image name insert not image url
<asp:TemplateField>
<itemtemplate>
XML
<asp:Image ID="Image1" runat="server" ImageUrl ='<%# Eval("Logo") %>'>
              </asp:Image>






but image not retrieve by image control
Posted
Updated 11-Nov-12 20:16pm
v2
Comments
Sergey Alexandrovich Kryukov 12-Nov-12 3:34am    
Not clear. What do your try to achieve?
--SA

1 solution

Dude,as per my understanding..only the image name is stored in the database but the imageurl.So only with the image name you cannot get the image from database.Also bind the image path to the Imageurl as shown below.

C#
ImageUrl='<%# String.Format("~/path/to/image/" + Eval("product_img")) %>'



Replace ~/path/to/image/ with the path where the images are stored.


---Prathap.
 
Share this answer
 
Comments
Mas11 12-Nov-12 6:33am    
Good Answer !

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