You need to create a handler (.ashx) and use below code on your GridView
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<asp:Image ID="imgPreview" ImageUrl='<%#
"ImageHandler.ashx?imgID="+ Eval("ImageID") %>' runat="server"
Height="80px" Width="80px" />
</ItemTemplate>
</asp:TemplateField>
and here is the code you need to write on your ImageHandler.ashx file
public void ProcessRequest(HttpContext context)
{
SqlDataReader rdr = null;
SqlConnection conn = null;
SqlCommand selcmd = null;
try
{
conn = new SqlConnection(ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString);
selcmd = new SqlCommand("select Image from tblImage where ImageID=" + context.Request.QueryString["imgID"], conn);
conn.Open();
rdr = selcmd.ExecuteReader();
while (rdr.Read())
{
context.Response.ContentType = "image/jpg";
context.Response.BinaryWrite((byte[])rdr["Image"]);
}
rdr.Close();
}
finally
{
conn.Close();
}
}