private void repositoryItemPopupContainerEdit1_QueryPopUp(object sender, CancelEventArgs e) { if (this.value == null) { this.value = ""; } DataRow[] dataRowArray = this.ds1.destanationroute.Select("iddestanation = " + this.value); List <string> list = new List <string>(); foreach (DataRow dataRow in dataRowArray) { list.Add(dataRow["idroute"].ToString()); } for (int index = 0; index < this.checkedListBox1.Items.Count; ++index) { DestanationForm.RouteItem item = this.checkedListBox1.Items[index] as DestanationForm.RouteItem; if (list.Find((Predicate <string>)(x => x == item.ID.ToString())) != null) { this.checkedListBox1.SetItemChecked(index, true); } else { this.checkedListBox1.SetItemChecked(index, false); } } }
private void repositoryItemPopupContainerEdit1_QueryDisplayText(object sender, QueryDisplayTextEventArgs e) { if (e == null || e.EditValue == null) { return; } this.value = e.EditValue.ToString(); e.DisplayText = ""; if (string.IsNullOrEmpty(this.value)) { return; } DataRow[] dataRowArray = this.ds1.destanationroute.Select("iddestanation = " + this.value); List <string> list = new List <string>(); foreach (DataRow dataRow in dataRowArray) { list.Add(dataRow["idroute"].ToString()); } for (int index = 0; index < this.checkedListBox1.Items.Count; ++index) { DestanationForm.RouteItem item = this.checkedListBox1.Items[index] as DestanationForm.RouteItem; if (list.Find((Predicate <string>)(x => x == item.ID.ToString())) != null) { if (e.DisplayText != "") { e.DisplayText += ", "; } e.DisplayText += item.ToString(); } } }