Possible Duplicate:
How to show a image in database in the image control of Asp.net?
I am returning a list of products from a database. Inside this list i am saving database images as bytearrays. Currently I am displaying about 30 products on a page and i would like to add their images next to the product information. What would be the easiest way to go about this?
What I have:
public Image PopulatePicture()
{
Image newImage;
//Read image data into a memory stream
using (MemoryStream ms = new MemoryStream(ImageByteArray, 0, ImageByteArray.Length))
{
ms.Write(ImageByteArray, 0, ImageByteArray.Length);
//Set image variable value using memory stream.
newImage = Image.FromStream(ms, true);
}
return newImage;
}
I have an error on Image.FromStream (System.Web.UI.WebControls does not contain a definition for FromStream)