0% found this document useful (1 vote)
113 views1 page

GridView - Image Column From Database

This code displays images stored as links in a database in an ASP.NET GridView. It uses an <img> tag bound to the "ImageURL" field to show each image. It also includes columns for the image name and option links to edit or delete each record.

Uploaded by

info.glcom5161
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
113 views1 page

GridView - Image Column From Database

This code displays images stored as links in a database in an ASP.NET GridView. It uses an <img> tag bound to the "ImageURL" field to show each image. It also includes columns for the image name and option links to edit or delete each record.

Uploaded by

info.glcom5161
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

http://stackoverflow.

com/questions/29739907/display-an-image-from-a-link-in-an-a
sp-net-gridview
You can try below code to display image in GridView which stored as a link in da
tabase. I have used simple HTML img tag to display image.
<asp:GridView ID="gvImages" CssClass="Gridview" runat="server" AutoGenerateColu
mns="False"
HeaderStyle-BackColor="#7779AF" HeaderStyle-ForeColor="white">
<Columns>
<asp:BoundField HeaderText = "Image Name" DataField="ImageURL" />
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<img src='<%# Eval("ImageURL") %>' Height="150" Width="150" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:TemplateField>
<ItemStyle Width="10%" HorizontalAlign="center" Vert
icalAlign="Bottom"/>
<HeaderStyle HorizontalAlign="center" />
<HeaderTemplate>
<strong>Options</strong>
</HeaderTemplate>
<ItemTemplate>
<a href="#" onclick='popModalSave("<%# Eval("DPT
_KEY")%>","<%# Eval("DPT_NME")%>")'>Edit</a>
&nbsp;&nbsp;
<a href="#" onclick='popModalDel("<%# Eval("DPT_
KEY")%>","<%# Eval("DPT_NME")%>")'>Delete</a>
</ItemTemplate>
</asp:TemplateField>

You might also like