Current filter:
                                You should refresh the page.
                                  • My scenario:

                                    I address BO i have postal code and post city (in Poland one postal code can be the same for few cities)
                                    When user enter postal code i fill list of avaiable cities with entered postal code. if there is only one city i fill postal city, if there is few cities i clear old post city .
                                    At this moment user have to select PostCity lookup property editor and select one record. I want to force display all avaiable cities automatically after user enter postal code and there are few post cities. How to do this?

                                    [C#]
                                    [Size(10)] [ImmediatePostData] [ModelDefault("DisplayFormat", "00-000")] [ModelDefault("EditMask", "00-000")] public string KodPocztowy //PostalCode { get => kodPocztowy; set { var modified = SetPropertyValue(nameof(KodPocztowy), ref kodPocztowy, value); if (!IsLoading && !IsSaving && modified && value.Length >= 5) { var a = value; var b = KodPocztowy; KodPocztowy = new String(KodPocztowy.Where(Char.IsDigit).ToArray()); if (KodPocztowy.Length == 0 || KodPocztowy.Length == 5) RefreshPasujacePoczty(); } } } [ImmediatePostData] [LookupEditorMode(LookupEditorMode.AllItemsWithSearch)] [DataSourceProperty("PasujacePoczty")] public KodyPocztowe Poczta //Post City { get => poczta; set { var modified = SetPropertyValue(nameof(Poczta), ref poczta, value); if (!IsLoading && !IsSaving && modified && value != null) { KodPocztowy = Poczta.KodPocztowy; Miejscowosc = Poczta.Miejscowosc; Wojewodztwo = Poczta?.Wojewodztwo?.OPIS; Kraj = "Polska"; } } } private XPCollection<KodyPocztowe> pasujacePoczty; [Browsable(false)] public XPCollection<KodyPocztowe> PasujacePoczty { get { if (pasujacePoczty == null) { // Retrieve all Accessory objects pasujacePoczty = new XPCollection<KodyPocztowe>(Session); // Filter the retrieved collection according to current conditions RefreshPasujacePoczty(); } // Return the filtered collection of Accessory objects return pasujacePoczty; } } private void RefreshPasujacePoczty() { if (pasujacePoczty == null) return; if (string.IsNullOrEmpty(KodPocztowy)) { // Show all avaiable //pasujacePoczty.Criteria = CriteriaOperator.Parse("GCRecord = null"); } else { // show matching criteria pasujacePoczty.Criteria = new BinaryOperator("KodPocztowy", KodPocztowy); } // When there is only one use it // Otherwise clear lookup editor value var pocztaold = Poczta; if (pasujacePoczty.Count > 1) { Poczta = null; //how to force display lookup propery editor list } else { Poczta = pasujacePoczty[0]; } OnChanged(nameof(Poczta), pocztaold, Poczta); }

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Jacek,

                                As far as I understand, you want to show the City lookup editor's dropdown when the user enters certain postal codes. To do this, create a ViewController that handles the IObjectSpace.ObjectChanged event and expands the lookup editor. Refer to the following topics for additional information:
                                Ways to Access UI Elements and Their Controls
                                IObjectSpace.ObjectChanged Event
                                Reference (Foreign Key, Complex Type) Properties

                                In addition, refer to similar Support Center tickets:
                                How to deal with a delay when opening LookupPropertyEditor based on data coming from SQL views and a remote/linked database server
                                ASPxLookupPropertyEditor - How to auto show the drop down editor or display a find popup in code

                                • Jacek Kosiński 09.24.2019

                                  thanks for help
                                  my controller looks like below and do what i need

                                  [C#]
                                  public class AdresyBusinessLogicViewController : ObjectViewController<DetailView, PeselSupport> { LookupEdit MyLookupZam; LookupEdit MyLookupKor; protected override void OnActivated() { base.OnActivated(); ObjectSpace.ObjectChanged += ObjectSpace_ObjectChanged; var targetZam = View.FindItem("AdresZamieszkania.Poczta"); var targetKor = View.FindItem("AdresKorespondencyjny.Poczta"); if (targetZam != null) { if (targetZam.Control == null) { targetZam.ControlCreated += TargetZam_ControlCreated; } else { MyLookupZam = ((LookupPropertyEditor)targetZam).Control; } if (targetKor.Control == null) { targetKor.ControlCreated += TargetKor_ControlCreated; } else { MyLookupKor = ((LookupPropertyEditor)targetKor).Control; } } } private void TargetZam_ControlCreated(object sender, EventArgs e) { MyLookupZam = ((LookupPropertyEditor)sender).Control; } private void TargetKor_ControlCreated(object sender, EventArgs e) { MyLookupKor = ((LookupPropertyEditor)sender).Control; } void ObjectSpace_ObjectChanged(object sender, ObjectChangedEventArgs e) { var viewObject = (PeselSupport)View.CurrentObject; var changedObject = e.Object; if (changedObject is Adres) { if (viewObject.AdresZamieszkania == (Adres)e.Object && ObjectSpace.IsModified && e.OldValue != e.NewValue) { PrepareExpand(e, MyLookupZam); } if (viewObject.AdresKorespondencyjny == (Adres)e.Object && ObjectSpace.IsModified && e.OldValue != e.NewValue) { PrepareExpand(e, MyLookupKor); } } } private void PrepareExpand(ObjectChangedEventArgs e, LookupEdit lookupEdit) { if (e.PropertyName == "KodPocztowy") { var changedAddress = (Adres)e.Object; if (MyLookupZam != null && changedAddress.KodPocztowy.Length == 5) { var pasujaceKody = ObjectSpace.GetObjects<KodyPocztowe>().Where(m => m.KodPocztowy == changedAddress.KodPocztowy); if (pasujaceKody.Count() > 1) { lookupEdit.BeginInvoke(new MethodInvoker(lookupEdit.ShowPopup)); } } } } protected override void OnDeactivated() { base.OnDeactivated(); ObjectSpace.ObjectChanged -= ObjectSpace_ObjectChanged; } }
                                • Anatol (DevExpress Support) 09.24.2019

                                  You are welcome!