Here is the code, the problem is that the image is displayed but after clearing all the page, i need it to be drawn inside the user control that is inside the web form.
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ObjHoteles"] == null)
{
Label1.Text = "select hotel first please.";
}
else
{
if (!IsPostBack)
{
List<Byte[]> ArrayFotos = new List<Byte[]>();
string NombreDelHotel = "";
Hoteles Hotel1 = (Hoteles)Session["ObjHoteles"];
NombreDelHotel = Hotel1.NombreHotel;
ArrayFotos = Persistencia.PersistenciaFotos.FotosDeHotel(NombreDelHotel);
Session["CantFotos"] = ArrayFotos.Count();
Byte[] Foto = ArrayFotos[0];
Response.Buffer = true;
Response.ContentType = "image/jpeg";
Response.Expires = 0;
Response.OutputStream.Write(Foto, 0, Foto.Length);
Session["NumFoto"] = 0;
}
else
{
List<Byte[]> ArrayFotos = new List<Byte[]>();
string NombreDelHotel = "";
Hoteles Hotel1 = (Hoteles)Session["ObjHoteles"];
NombreDelHotel = Hotel1.NombreHotel;
ArrayFotos = Persistencia.PersistenciaFotos.FotosDeHotel(NombreDelHotel);
Session["CantFotos"] = ArrayFotos.Count();
Byte[] Foto = ArrayFotos[(int)Session["NumFoto"]];
Response.Buffer = true;
Response.Clear();
Response.ContentType = "image/jpeg";
Response.Expires = 0;
Response.BinaryWrite(Foto);
}
}
}
I need to display the image where the user control is located inside the web form. Not in a new page.
I need to use a User Control it was specifically requested by my client.