protected void GridViewFilterScelti_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gdr = (GridViewRow)((Control)e.CommandSource).NamingContainer; int rowIndex = gdr.RowIndex; if (e.CommandName == "Deseleziona") { GridViewRow row = GridViewFilterScelti.Rows[rowIndex]; row.Cells[1].Text = HttpUtility.HtmlDecode(row.Cells[1].Text); row.Cells[2].Text = HttpUtility.HtmlDecode(row.Cells[2].Text); if (row.Cells[1].Text == SelectedFilterDataTable_Types.Data) { dictionarySelectedRows.Remove(SelectedFilterDataTable_Types.Data); } else { Dictionary <string, string> CurrentDictionary; if (dictionarySelectedRows.TryGetValue(row.Cells[1].Text, out CurrentDictionary)) { CurrentDictionary.Remove(row.Cells[2].Text.Split((" - ").ToCharArray())[0]); dictionarySelectedRows[row.Cells[1].Text] = CurrentDictionary; } } dataTableSelectedItems.RemoveFiltro(row.Cells[1].Text, row.Cells[2].Text); GridViewFilterScelti.DataSource = dataTableSelectedItems.getDataTable(); GridViewFilterScelti.DataBind(); } }
public void RemoveElement(string name) { try { CurrentDictionary.Remove(name); foreach (Selector dependency in Dependencies) { if (dependency.Items.Contains(name)) { dependency.Items.Remove(name); } //dependency.Items.Refresh(); } } catch { throw new Exception($"Element {name} doesn't exist"); } }