Hello Experts
First you need to create a handler for making this...........
and in the Database you will create a new field name U_image and its datatype will be img in the running database
<%@ WebHandler Language="C#" Class="UserImage" %>
using System;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;
public class UserImage : IHttpHandler {
public void ProcessRequest (HttpContext context)
{
Int64 imageid = Convert.ToInt64(context.Request.QueryString["userid"]);
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
connection.Open();
SqlCommand command = new SqlCommand("select U_image from User_Registration_Details where Userid=" + imageid, connection);
SqlDataReader dr = command.ExecuteReader();
if (dr.Read())
{
if (dr["U_image"] != DBNull.Value)
{
context.Response.BinaryWrite((Byte[])dr["U_image"]);
}
}
connection.Close();
context.Response.End();
}
public bool IsReusable {
get {
return false;
}
}
}
Then on ASPX
<asp:Repeater ID="rpt_dealer" runat="server">
<ItemTemplate>
<table width="750" border="0" cellspacing="4" cellpadding="0">
<tr>
<td colspan="2" class="main-head-txt">
<asp:Image ID="imgshow" runat="server" Width="74px" Height="60px" ImageUrl='<%#"UserImage.ashx?userid=" +Eval("UserId") %>'
onerror="this.onerror=null;this.src='images/user.gif';" AlternateText="Image not found" />
</td></tr></table></ItemTemplate></Repeater>