ListView Rendering image issue.
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6878033/rendering-bytes-from-sql-server-to-an-image-control">Rendering bytes from sql server to an image control?</a>  </p>
</blockquote>



<pre><code>&lt;asp:ListView ID="lvGallery" runat="server" DataSourceID="SqlDataSource1"&gt;
   &lt;LayoutTemplate&gt;
   &lt;table runat="server" id="tableGallery"&gt;
   &lt;tr runat="server" id="itemPlaceHolder"&gt;

   &lt;/tr&gt;

   &lt;/table&gt;

   &lt;/LayoutTemplate&gt;
   &lt;ItemTemplate&gt;       
   &lt;tr&gt;&lt;td&gt;
   &lt;div class="box_img2"&gt;
            &lt;div class="g_size"&gt;
                &lt;a runat="server" id="linkImage"&gt;&lt;img id="Image1" runat="server" src="MyImage.jpg" /&gt;&lt;/a&gt;
            &lt;/div&gt;         
   &lt;/div&gt;
   &lt;/td&gt;&lt;/tr&gt;
   &lt;/ItemTemplate&gt;
   &lt;/asp:ListView&gt;

    &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="Data Source=CHANDAN-PC;Initial Catalog=Metamorphism;User ID=sa;password=chandan;" 
        ProviderName="System.Data.SqlClient" 
        SelectCommand="SELECT [Image] FROM [GalleryImages]"&gt;&lt;/asp:SqlDataSource&gt;


public void ProcessRequest(HttpContext context)
        {
            //write your handler implementation here.
            string username = Convert.ToString(context.Request.QueryString["username"]);
            if (username != null)
            {
                DataSet ds = new DataSet();
                SqlDataAdapter da = new SqlDataAdapter();
                byte[] arrContent;
                DataRow dr;
                string strSql;
                strSql = "Select Image from GalleryImages where username = '" + username + "'";
                da = new SqlDataAdapter(strSql, connection.ConnectionString);
                da.Fill(ds);
                dr = ds.Tables[0].Rows[0];
                arrContent = (byte[])dr["ImageFile"];
                context.Response.ContentType = "jpeg";
                context.Response.OutputStream.Write(arrContent, 0, arrContent.Length);
                context.Response.End();
            }
        }
</code></pre>

<p>I have added httphandlers tag in web.config.</p>
