This is my code, all it does is clear the web page and draw the image, so the rest of the form disappears! I need to show the image inside the form.
This is my User Control to display the images:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["ObjHoteles"] == null)
{
Label1.Text = "Por favor, primero seleccione un hotel para desplegar las fotos.";
}
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.Clear();
Response.ContentType = "image/jpeg";
Response.Expires = 0;
Response.BinaryWrite(Foto);
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 find a way that doesnt clear all the page, just draw the image inside the user control.