コード例 #1
0
        protected void dgNidito_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "btnEditar")
            {
                try
                {
                    int id = Convert.ToInt32(e.CommandArgument);
                    Response.Redirect("AddEditNidito.aspx?idNidito=" + id);

                }
                catch (Exception)
                {
                    // lblerror.Text = "ocurrió un error al intentar Editar";
                }
            }

            if (e.CommandName == "btnEliminar")
            {
                try
                {
                    int indice = Convert.ToInt32(e.CommandArgument);
                    NiditoDAO bdArticulo = new NiditoDAO();

                    if (bdArticulo.EliminarNidito(indice))
                    {
                        lblConfirmacion.Text = "Se eliminó correctamente";
                        CargaNidito();

                    }
                    else
                        lblConfirmacion.Text = "ocurrió un error al intentar eliminar";

                }
                catch (Exception)
                {
                    lblConfirmacion.Text = "ocurrió un error al intentar eliminar";
                }

            }
        }