Ejemplo n.º 1
0
  protected void Eliminar(object sender, ImageClickEventArgs e)
  {
      ImageButton btnEliminar = ((ImageButton)sender);
      GridViewRow row         = btnEliminar.NamingContainer as GridViewRow;
      string      pk          = GridView1.DataKeys[row.RowIndex].Values[0].ToString();


      BL_EQUIPO_TRABAJO obj         = new BL_EQUIPO_TRABAJO();
      DataTable         dtResultado = new DataTable();

      dtResultado = obj.uspUPD_EQUIPO_TRABAJADOR(Convert.ToInt32(btnEliminar.CommandArgument), 0);
      equipo();
  }
Ejemplo n.º 2
0
  protected void btnEliminar_Click(object sender, EventArgs e)
  {
      BL_EQUIPO_TRABAJO obj         = new BL_EQUIPO_TRABAJO();
      DataTable         dtResultado = new DataTable();


      string cleanMessage = string.Empty;



      int intContador = 0;

      if (GridView1.Rows.Count == 0)
      {
          cleanMessage = "No existe Registros";
          ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
      }

      foreach (GridViewRow Fila in GridView1.Rows)
      {
          CheckBox ChkBoxCell = ((CheckBox)Fila.FindControl("chkSelect"));
          if (ChkBoxCell.Checked == true)
          {
              intContador += 1;
          }
      }

      if (intContador == 0)
      {
          cleanMessage = "Debe seleccionar al menos un registro.";
          ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
      }

      int Cod;


      foreach (GridViewRow row in GridView1.Rows)
      {
          CheckBox ChkBoxCell = ((CheckBox)row.FindControl("chkSelect"));
          if (ChkBoxCell.Checked)
          {
              Cod         = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Values[0].ToString()); // extrae key
              dtResultado = obj.uspUPD_EQUIPO_TRABAJADOR(Cod, 0);
          }
          ChkBoxCell = null;
      }

      equipo();
  }