protected void GvPersonas_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         int index = Convert.ToInt32(e.CommandArgument);
         GvPersonas.SelectRow(index);
         string id = GvPersonas.SelectedRow.Cells[1].Text;
         if (sesion.ID_PERSONA.Equals(id))
         {
             ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Hello", "Negado()", true);
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('No se puede borrar usted mismo de la solicitud')", true);
         }
         else
         {
             dt.Rows.RemoveAt(index);
             GvPersonas.DeleteRow(index);
             GvPersonas.DataSource = dt;
             GvPersonas.DataBind();
             ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Hello", "Negado()", true);
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Hello", "Negado()", true);
     }
 }
 protected void BtnAgregarPersona_Click(object sender, EventArgs e)//Evento para boton agregar que agrega una persona que este seleccionada en el combobox
 {
     if (Ddl_PersonasSolicitud.SelectedValue != "null")
     {
         if (ComprobarListaPersonas() == false)
         {
             if (dt != null)
             {
                 DataTable dt1 = dt;
                 DataRow   Row = dt1.NewRow();
                 Row[0] = Ddl_PersonasSolicitud.SelectedValue.ToString();
                 Row[1] = Ddl_PersonasSolicitud.SelectedItem.ToString();
                 dt.Rows.Add(Row);
                 GvPersonas.DataSource = dt1;
                 GvPersonas.DataBind();
                 ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Hello", "Negado()", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Hello", "Negado()", true);
         }
     }
     else
     {
         if (!IsPostBack)
         {
             dt = new DataTable();
             dt.Columns.Add(new DataColumn("Idetificacion", typeof(string)));
             dt.Columns.Add(new DataColumn("Nombre Completo", typeof(string)));
             DataRow Row = dt.NewRow();
             Row[0] = sesion.ID_PERSONA;
             Row[1] = Ddl_PersonasSolicitud.Items.FindByValue(sesion.ID_PERSONA);
             dt.Rows.Add(Row);
             GvPersonas.DataSource = dt;
             GvPersonas.DataBind();
             ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Hello", "Negado()", true);
         }
     }
 }
Example #3
0
        private void RefreshModel()
        {
            var refresh = new SsfPersonaBO().GetAll();

            GvPersonas.DataBind();
        }