protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { Productos = NegocioProducto.ListarProductos(); } catch (Exception ex) { Session["Error" + Session.SessionID] = ex; Response.Redirect("frmLog.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { try { if (Request.QueryString["idprd"] == null) { //por si accede a la pagina con el link Session["Error" + Session.SessionID] = "Ups, Aún no has seleccionado un producto."; Response.Redirect("/frmLog.aspx", false); } prodSeleccionado = Convert.ToInt32(Request.QueryString["idprd"]); Productos = NegocioP.ListarProductos(); producto = Productos.Find(J => J.ID == prodSeleccionado); //grid.DataSource = NegocioVoucher.ListarVouchers(); //grid.DataBind(); } catch (Exception ex) { Session["Error" + Session.SessionID] = ex; Response.Redirect("/frmLog.aspx"); } }