public void grdLista_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = grdLista.Rows[index]; //decimal IDUSUARIOSELECCIONADODELAGRILLA = Convert.ToDecimal(grdLista.Rows[index].Cells[2].Text); var idpersona = grdLista.DataKeys[index].Value; decimal IDUSUARIOSELECCIONADODELAGRILLA = Convert.ToDecimal(idpersona); bool _actualizado; _actualizado = PERSONASCER.PERSONASCEREliminarbyIDPERSONA(IDUSUARIOSELECCIONADODELAGRILLA, 0, DateTime.Now); if (_actualizado == true) { CARGARGRILLA(); Alerta.notiffy("Registro Exitoso", "Se ha eliminado correctamente la persona", "sucessful", this, GetType()); } else { Alerta.notiffy("Registro Exitoso", "Se ha eliminado correctamente la persona", "warning", this, GetType()); } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Editar")) { int index = Convert.ToInt32(e.CommandArgument); string code = GridView1.DataKeys[index].Value.ToString(); PERSONACERSELECCIONADA = PERSONASCER.PERSONASCERObtenerbyIDPERSONA(Convert.ToDecimal(code), 0); Session["PERSONACERSELECCIONADA"] = PERSONACERSELECCIONADA; txt_APELLIDOS.Text = PERSONACERSELECCIONADA[0].APELLIDOS; txt_CARGO.Text = PERSONACERSELECCIONADA[0].CARGO; txt_DEPENDENCIA.Text = PERSONACERSELECCIONADA[0].DEPENDENCIA; txt_EMAIL.Text = PERSONACERSELECCIONADA[0].EMAIL; txt_FUNCIONES.Text = PERSONACERSELECCIONADA[0].FUNCIONES; txt_IDENTIFICACION.Text = PERSONACERSELECCIONADA[0].IDENTIFICACION; txt_MOVIL.Text = PERSONACERSELECCIONADA[0].MOVIL; txt_NOMBRES.Text = PERSONACERSELECCIONADA[0].NOMBRE; txt_SUELDO.Text = PERSONACERSELECCIONADA[0].SUELDO; txt_TELEFONO.Text = PERSONACERSELECCIONADA[0].TELEFONO; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script type='text/javascript'>"); sb.Append("$('#myModal').modal('show');"); sb.Append(@"</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModalScript", sb.ToString(), false); } else if (e.CommandName.Equals("Eliminar")) { int index = Convert.ToInt32(e.CommandArgument); Decimal code = Convert.ToDecimal(GridView1.DataKeys[index].Value); bool _actualizado; _actualizado = PERSONASCER.PERSONASCEREliminarbyIDPERSONA(code, 0, DateTime.Now); if (_actualizado == true) { CARGARGRILLA(); CARGARGRILLA2(); CARGARGRILLA3(); Alerta.notiffy("Eliminación Exitosa", "Se ha Eliminado correctamente la persona", "sucessful", this, GetType()); } else { Alerta.notiffy("Operacion incompleta", "No se ha podido Eliminar la persona!", "warning", this, GetType()); } //DataTable dt = new DataTable(); //dt = PERSONASCER.PERSONASCERObtener(0); //DetailsView1.Visible = false; //if (dt.Rows.Count > 0) //{ // DetailsView1.Visible = true; // DetailsView1.DataSource = null; // DetailsView1.DataBind(); // DetailsView1.DataSource = dt; // DetailsView1.DataBind(); //} //else //{ // DetailsView1.Visible = false; // DetailsView1.DataSource = null; // DetailsView1.DataBind(); //} } }