protected void IncludeAttributeButton_Click(object sender, EventArgs e) { if (AttributeList.SelectedItem != null) { var items = AttributeList.Items.OfType <ListItem>().Where(o => o.Selected).Select(o => o.Value); var fields = EntityFilter.Entity.Attributes.Where(o => items.Contains(o.ID.ToString())).Select(a => new EntityFilterField(a)); var index = FieldList.SelectedIndex; if (index == -1) { EntityFilter.Fields.AddRange(fields); } else { EntityFilter.Fields.InsertRange(index + 1, fields); } save = false; FieldList.DataBind(); } }
protected void ExcludeAttributeButton_Click(object sender, EventArgs e) { var index = FieldList.SelectedIndex; if (index != -1) { EntityFilter.Fields.RemoveAt(index); if (index == EntityFilter.Fields.Count) { FieldList.SelectedIndex = -1; } save = false; FieldList.DataBind(); } }
protected void ResetFiltersButton_Click(object sender, EventArgs e) { isResetFiltersButton_Click = true; if (EntityFilter != null) { foreach (EntityFilterField field in EntityFilter.Fields) { var i = field.Sequence; var filterControl = FieldList.Items[i].FindControl("CompositePredicateControl") as CompositePredicateControl; filterControl.RejectFilter(); var userPredicateBox = FieldList.Items[i].FindControl("UserPredicateBox") as TextBox; userPredicateBox.Text = null; } } FieldList.DataBind(); }