protected void btnGuardar_Click(object sender, ImageClickEventArgs e) { //recorro grilla de deducibles int numFilas = this.gridDeducibles.Rows.Count; for (int i = 0; i < numFilas; i++) { CheckBox AuxCheckBox = (CheckBox)gridDeducibles.Rows[i].FindControl("CheckDeducible"); if (AuxCheckBox.Checked) { odsInsertDeduciblesAjuste.InsertParameters.Clear(); odsInsertDeduciblesAjuste.InsertParameters.Add("ajusteId", this.AjusteId); odsInsertDeduciblesAjuste.InsertParameters.Add("polizaId", this.PolizaId); odsInsertDeduciblesAjuste.InsertParameters.Add("atributoId", ((Label)gridDeducibles.Rows[i].FindControl("lblDeducible")).Text); odsInsertDeduciblesAjuste.InsertParameters.Add("usuario", au.UserName); odsInsertDeduciblesAjuste.InsertMethod = "Insert"; odsInsertDeduciblesAjuste.Insert(); } else { dsPolizaTableAdapters.AtributoPolizaSelectByIdTableAdapter itemAdapter = new dsPolizaTableAdapters.AtributoPolizaSelectByIdTableAdapter(); itemAdapter.DeleteDeduciblesAjuste(Convert.ToDecimal(((Label)gridDeducibles.Rows[i].FindControl("lblDeducible")).Text),Convert.ToDecimal(AjusteId)); } } }
protected void gridDeducibles_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Eliminar") { dsPolizaTableAdapters.AtributoPolizaSelectByIdTableAdapter itemAdapter = new dsPolizaTableAdapters.AtributoPolizaSelectByIdTableAdapter(); itemAdapter.Delete(decimal.Parse(e.CommandArgument.ToString())); gridDeducibles.DataBind(); } }