To show images you can use HTTP Handler and GridView.
For that follow these steps-
Step1: Take one GridView , and design it with Custom Column, Before that set it's AutoGeneratedColumns Property to False.
like this -
To show image in GridView, take one image control in itemTemplate of GridView.
<ItemTemplate>
<asp:Image ID="Image2" runat="server" ImageUrl='<%# "Handler1.ashx?EmpId=" + Eval("Empid")%>' />
</ItemTemplate>
Step2 ; After Designing GridView Take one Hander , Because this will be used for showing images
After Designing GridView Take one Hander , Because this will be used for showing images
Use handler to show image-
//connect with database where you have stored images
public void ProcessRequest(HttpContext context)
{
SqlConnection cn = new SqlConnection("YOUR CONNECTION STRING");
cn.Open();
string empid = context.Request.QueryString["EmpID"].ToString();
SqlCommand cmd = new SqlCommand("select empimage from empimageTABLE where empid=" + empid, cn);
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
context.Response.BinaryWrite((byte[])dr["empimage"]);
dr.Close();
cn.Close();
}
try this code and let me know.