To display an image in gridview (file name of the image is stored in database)

Posted by Nithadeepak under ASP.NET category on | Points: 40 | Views : 4191
<asp:FileUpload ID="fileImage" runat="server"  />


Code for storing the fileImage.FileName in database goes here...

fileImage.SaveAs(Server.MapPath(".\\images\\" + fileImage.FileName));

Retrieving the image in gridview
<asp:GridView ...>
<asp:TemplateField HeaderText="Image" >
<ItemTemplate >
<asp:Image Height="30" Width="45" ID="img1" runat="server" ImageUrl='<%#Eval("Image","images/{0}") %>' />


Comments or Responses

Posted by: Lekhyap on: 5/4/2011 Level:Starter | Status: [Member] | Points: 10
Posted by: Venu_msis on: 5/4/2011 Level:Starter | Status: [Member] | Points: 10
This code won't work if the application runs in multiple Servers.

Login to post response