Exemplo n.º 1
0
 protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DataRowView dataRow = (DataRowView)e.Row.DataItem;
         ImageButton foto    = (ImageButton)e.Row.FindControl("IFoto");
         ImageButton addb    = (ImageButton)e.Row.FindControl("IBAnnadir");
         if (dataRow["foto"].ToString() != "")
         {
             foto.ImageUrl = "Handlers/ImageHandler.ashx?id=" + dataRow["Id_producto"].ToString();
             foto.Width    = 93;
             foto.Height   = 107;
         }
         // Almacenando id y precio del producto
         addb.CommandName = dataRow["Id_producto"].ToString();
         addb.Enabled     = (int)dataRow["Existencia"] > 0;
         foto.CommandName = dataRow["Id_producto"].ToString();
         // ************************************
         User_Controls_ProductItemList   c     = (User_Controls_ProductItemList)e.Row.FindControl("Producto_LI");
         User_Controls_EditDeleteControl ed_uc = (User_Controls_EditDeleteControl)e.Row.FindControl("ED_Control");
         c.SetIDProducto((int)dataRow["Id_producto"]);
         c.Nombre_producto       = dataRow["Nombre_producto"].ToString();
         c.Marca_producto        = dataRow["Marca"].ToString();
         c.Precio_producto       = dataRow["Precio"].ToString();
         c.Dispobible            = (int)dataRow["Existencia"] > 0;
         c.Descripcion_producto  = "[" + dataRow["Nombre_categoria"].ToString() + "]";
         ed_uc.ID_Item           = (int)dataRow["Id_producto"];
         ed_uc.Eliminar_onClick += new User_Controls_EditDeleteControl.LinkClick_Delegate(Eliminar_onClick);
     }
 }
Exemplo n.º 2
0
 protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DataRowView dataRow = (DataRowView)e.Row.DataItem;
         ImageButton addb    = (ImageButton)e.Row.FindControl("IBAnnadir");
         ImageButton foto    = (ImageButton)e.Row.FindControl("IFoto");
         if (dataRow["foto"].ToString() != "")
         {
             ((ImageButton)e.Row.FindControl("IFoto")).ImageUrl = "Handlers/ImageHandler.ashx?id=" + dataRow["Id_producto"].ToString();
             ((ImageButton)e.Row.FindControl("IFoto")).Width    = 93;
             ((ImageButton)e.Row.FindControl("IFoto")).Height   = 107;
         }
         addb.CommandName = dataRow["Id_producto"].ToString();
         addb.Enabled     = (int)dataRow["Existencia"] > 0;
         foto.CommandName = dataRow["Id_producto"].ToString();
         User_Controls_ProductItemList   c     = (User_Controls_ProductItemList)e.Row.FindControl("Producto_LI");
         User_Controls_EditDeleteControl ed_uc = (User_Controls_EditDeleteControl)e.Row.FindControl("ED_Control");
         //Control c_ = LoadControl("~/User_Controls/ProductItemList.ascx");
         //Control ed_uc_ = LoadControl("~/User_Controls/EditDeleteControl.ascx");
         //c = (User_Controls_ProductItemList)c_;
         //ed_uc = (User_Controls_EditDeleteControl)ed_uc_;
         //Control c = LoadControl("~/User_Controls/ProductItemList.ascx");
         //Control ed = LoadControl("~/User_Controls/EditDeleteControl.ascx");
         c.SetIDProducto((int)dataRow["Id_producto"]);
         c.Nombre_producto      = dataRow["Nombre_producto"].ToString();
         c.Marca_producto       = dataRow["Marca"].ToString();
         c.Precio_producto      = dataRow["Precio"].ToString();
         c.Dispobible           = (int)dataRow["Existencia"] > 0;
         c.Descripcion_producto = dataRow["Descripcion"].ToString();
         //((IControl_EditDelete)ed).ID_Item = (int)dataRow["Id_producto"];
         ed_uc.ID_Item = (int)dataRow["Id_producto"];
         //e.Row.Cells[1].Controls.Add(c);
         //e.Row.Cells[3].Controls.Add(ed);
     }
 }