protected void btn_Eliminar_Click(object sender, EventArgs e) { if (Session["Imagenes"] != null) { DataTable tabla = (DataTable)Session["Imagenes"]; if (txb_posicionSeleccionada.Value != "null") { int pos = Convert.ToInt32(txb_posicionSeleccionada.Value); if (tabla.Rows[pos][0].ToString() != "null") { funcionesJuegos fJue = new funcionesJuegos(); if (Session["ImagenesAelminiar"] == null) { Session["ImagenesAelminiar"] = fJue.crearTablaImagenesEliminar(); } fJue.AgregarFilaImagenesEliminar((DataTable)Session["ImagenesAelminiar"], tabla.Rows[pos][0].ToString(), tabla.Rows[pos][1].ToString()); } if (tabla.Rows.Count > 0) { if ((bool)tabla.Rows[pos][2] == true) { lbl_portada.Text = "0"; } tabla.Rows[pos].Delete(); Session["Imagenes"] = tabla; } else { lbl_portada.Text = "0"; Session["Imagenes"] = null; } Session["CantImagenes"] = (int)Session["CantImagenes"] - 1; txb_posicionSeleccionada.Value = "null"; AgregarImagen(); } } }