How To Get Particular Image From The Database?
I have an image control on the aspx page like this
Solution 1:
This is just sample.Use:
<asp:image id="Image1" imageUrl="SideImageHandler.ashx?ID=<someId>"/>
add this in config:
<httpHandlers><addverb="*"path="img/*"type="SideImageHandler"/></httpHandlers>and in handler:
publicvoidProcessRequest (HttpContext context)
{
int ID;
if (context.Request.QueryString["ID"] != null)
ID= Convert.ToInt32(context.Request.QueryString["ID"]);
elsethrownew ArgumentException("No parameter specified");
byte[] imageData= ;//get the image data from the database using the employeeId Querystring
Response.ContentType = "image/jpeg";
Response.BinaryWrite(imageData);
}
Post a Comment for "How To Get Particular Image From The Database?"