Ejemplo n.º 1
0
        protected void GridViewPlates_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "buttonUpdate")
            {
                /*Button Update*/
                int crow;
                crow    = Convert.ToInt32(e.CommandArgument.ToString());
                this.id = GridViewPlates.Rows[crow].Cells[2].Text;
                fillData(GridViewPlates.Rows[crow].Cells[2].Text);
                ClientScript.RegisterStartupScript(this.GetType(), "key", "showModaUpdate()", true);
            }

            if (e.CommandName == "buttonDelete")
            {
                /*Button Delete*/
                int crow;
                crow = Convert.ToInt32(e.CommandArgument.ToString());
                string  id     = GridViewPlates.Rows[crow].Cells[2].Text;
                string  name   = GridViewPlates.Rows[crow].Cells[3].Text;
                Boolean delete = bll.DeletePlate(id);
                if (delete)
                {
                    alert("Eliminado " + name);
                }
                else
                {
                    alert("No se pudo eliminar este plato");
                }
                load();
            }
        }