protected void btnConfirm_Click(object sender, EventArgs e) { // Costruzione della lista di oggetti con le informazioni sui campi List <CustomObjHistoryState> customObjectsState = new List <CustomObjHistoryState>(); foreach (var item in this.dgFields.Items) { if (((CheckBox)(((DataGridItem)item).FindControl("chkEnabled"))).Checked) { customObjectsState.Add(new CustomObjHistoryState() { FieldId = Convert.ToInt32(((HiddenField)(((DataGridItem)item).FindControl("hfObjectId"))).Value), Enabled = true }); } } SelectiveHistoryResponse response = null; // Salvataggio dei dati if (Request["objType"] == "D") { response = ProfilazioneDocManager.ActiveSelectiveHistory(this.chkSelectDeselectAll.Checked, customObjectsState.ToArray(), ((DocsPAWA.DocsPaWR.Templates)Session["template"]).SYSTEM_ID.ToString()); } else { response = ProfilazioneFascManager.ActiveSelectiveHistory(this.chkSelectDeselectAll.Checked, customObjectsState.ToArray(), ((DocsPAWA.DocsPaWR.Templates)Session["template"]).SYSTEM_ID.ToString()); } if (!response.Result) { this.AjaxMessageBox.ShowMessage("Si è verificato un errore durante il salvataggio dei dati"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "Close", "window.close();", true); } }