예제 #1
0
        protected void gv_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "editar":
                Producto producto;
                producto = ProductoController.Get(Convert.ToInt32(e.CommandArgument));
                if (producto != null)
                {
                    this.txtDescri.Text           = producto.descripcion;
                    this.txtPrecio.Text           = producto.precioUnitario.ToString();
                    this.ddlTipo.SelectedValue    = producto.IdTipo.ToString();
                    this.ddlSubTipo.SelectedValue = producto.idSubTipo.ToString();
                    this.chkActiva.Checked        = producto.activo;
                    ViewState["id"] = e.CommandArgument;
                }
                break;

            case "eliminar":
                Mensaje("Eliminar", ProductoController.Borrar(Convert.ToInt32(e.CommandArgument)));
                break;
            }
            CargaGrilla();
        }