>Hi i want to create a web control that allow me to pass the PKID the return the data from DB as image in which i can drop it to my page. do you have any idea?
>I can do it by opening a separate page and render the data as stream
>
> Response.ContentType = "image/jpeg";
> Response.BinaryWrite( (byte[])dtrSearch["DocBin"] );
> /// DtrSearch is a SqlDataReader
>
>
>but when i creatr a control i can make it work because I cant use the response object any idea or alternative? thanks
Simplicio,
To serve up images from a database, first create a blank web form "ImageServ.aspx". In the page load, use Request.QueryString to get the PKID of the record containing the image and query the column into a byte array. Once you have the data, set the content-type of the response stream to the appropriate image type (jpeg, bmp, gif, or tiff) and send the byte array down the wire through the response stream.
Now in the web form that you want to display the image, put the URL of the ImageServ page with the PKID querystring in the ImageUrl property of an Image web control.