Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • [DevExpress Support: This ticket is cloned from the Q428641: How to implement auto complete/search like in Google.com ticket.]

                                    I have created a little demo application. It uses a SQL Express 2012 database.


                                    The purpose of this application is to help the user enter Danish addresses correctly. When entering text into 'Addresss' sugestions for street name will be shown. When a street name is selected the user should be able to continue writing even though the enter key has been used to select the street name. Whether street name has been selected with the enter key or arrow the 'Zip Code' should be filled with the zip code for the selected street name (if not already filled).


                                    Problems:

                                    2) When using the arrow keys to select a street name from the suggestions I do not get ItemRequestedByValue event and therefore can not fill out the "Zip Code" on exit. How can I get the value from the 'Zip Code' column when the user selects a suggestion with the arrow keys?

                                DX Demo, Combo Box - Filtering Large Data Source(2).zip
                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hello Nikolaj,

                                I would like to note that the ASPxComboBox.ItemRequestedByValue event is automatically generated each time a ASPxComboBox editor needs to identify the editor's selected item (ASPxComboBox.SelectedItem) by obtaining the corresponding data item specified by its value (ListEditItemRequestedByValueEventArgs.Value). So, to select an item, the entire text should match the search string. In this case, a single item will be returned from a database.

                                In addition, I should say that ViewState is not updated during a callback. So, the following code does not make sense:

                                	
                                [C#]
                                protected void CmbAddressOnItemRequestedByValue(object source, ListEditItemRequestedByValueEventArgs e) { ... ViewState[ViewStateKey] = value; }

                                Please also correct the ValueType property. It should be Int32 in your case.

                                • Halvorsen 09.25.2012

                                  Are you saying, that I can not get a drop down column value unless I type a value that exists in the drop down?

                                  The ViewState[ViewStateKey] = value is the reason that I can fill out the "Zip Code" field in the TextChanged. I save the current street ID in ViewState in event handler CmbAddressOnItemRequestedByValue and uses this to find the zip code in event handler CmbAddressTextChanged - and it works.

                                  When changing the ValueType to Int32 the drop down never shows!?

                                • Anthony (DevExpress Support) 09.26.2012

                                  Hi,

                                  >Are you saying, that I can not get a drop down column value unless I type a value that exists in the drop down?
                                  Yes, or unless you select a value from the drop-down list. But, you can use ASPxGridLookup that provides such a functionality. For example, you can handle the client-side KeyUp event and get a focused row index via the following code:

                                  s.GetGridView().GetFocusedRowIndex();
                                  
                                  Then you can obtain that row ZipCode via the ASPxClientGridView.GetRowValues method.

                                  Regarding the ViewState, it is not updated during callbacks. However, in your case, ASPxComboBox is working on postbacks since you have set the AutoPostback property to True in the OnInit method. When you are working with callbacks, please use the Session state instead of the ViewState.

                                  >When changing the ValueType to Int32 the drop down never shows!?
                                  Insert the "if (e.Value == null) return;" line in the ItemRequestedByValue event handler.

                                • Halvorsen 09.28.2012

                                  Thanks, I'll might have to look more into the ASPxGridLookup solution as an alternative.

                                • Halvorsen 09.28.2012

                                  Can I get the value in one of the ASPxClientListBox events e.g. SelectedIndexChanged ?

                                • Anthony (DevExpress Support) 09.28.2012

                                  Hello,

                                  Yes, ASPxListBox provides such client methods like the GetSelectedItems and GetSelectedValues.

                                You must  log in  or  register  to leave comments

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners