hiii
i store image in var binary feild.
i want to display image in datalist
here is my sample code pls help to solve this issue:
in datalist
<asp:Image ID="image1" runat="server" Width="150" Height="120"
AlternateText='<%# Eval("Name") %>'
ImageUrl='<%#
"ImageHandler.ashx?imgID=" + Eval("Id") %>'
/>
in Generic Handler
public void ProcessRequest(HttpContext context)
{
string imgid =
Convert.ToString(context.Request.QueryString["imgID"]);
int intImg = Convert.ToInt16(context.Request.QueryString["imgID"]);
MainDB ObjSms = new MainDB();
DataTable dt = new DataTable();
string str = "Select ImageName,Image From GalleryMst Where Id=" +
intImg;
dt = ObjSms.ExecuteDateTable(str);
if (dt.Rows.Count > 0)
{
//
context.Response.BinaryWrite((byte[])dt.Rows[0]["Image"]);
Byte[] bytes = (Byte[])dt.Rows[0]["Image"];
context.Response.ContentType = "image/bmp";
context.Response.OutputStream.Write(bytes, 0, bytes.Length);
}
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net