Click here to Skip to main content
11,410,118 members (61,302 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP:NET
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>

<asp:Image ID="Image1" runat="server" ImageUrl ='<%# Eval("Logo") %>'>
              </asp:Image>





but image not retrieve by image control
Posted 11-Nov-12 20:49pm
M@anish1.3K
Edited 11-Nov-12 21:16pm
v2
Comments
Sergey Alexandrovich Kryukov at 12-Nov-12 3:34am
   
Not clear. What do your try to achieve?
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.

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


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


---Prathap.
  Permalink  
Comments
Mas11 at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 229
1 OriginalGriff 140
2 Maciej Los 138
3 Sascha Lefévre 120
4 BillWoodruff 60
0 Sergey Alexandrovich Kryukov 8,771
1 OriginalGriff 6,905
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web01 | 2.8.150414.5 | Last Updated 12 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100