Hello,
I am using a UltraCombo to display a list of names in a drop down grid as matched by user input using AutoCompleteMode = Suggest. Due to the extremely large amount of names, I am populating the DataSource after the 3rd character typed from a web service. What I would like to do is keep the drop down list (grid with name details) visible at all times so that the user can see when data is available from an asyncronous call, or that there are no matches to thier input. When I enter the UltraCombo, I call ToggleDropDown() to display the empty drop down grid and then as data is available from the web service, it shows up in the list after I set the DataSource, which is exactly what I want so far. The problem is that if I backspace and change the text to something not in the newly populated list, the drop down disappears, and when new data is set to the UltraCombo's DataSource, its not visible to the user. If I call ToggleDropDown() when I get a set the DataSource,it shows the grid but it highlights the text input, which the user could still by typing, and could then type over thier existing text. Is there a way to keep the drop down visible at all times as long as the UltraCombo has the focus?
Thanks for the help,
Rob
Hi Rob,
Well, as I said, something in your code must be causing the dropdown to close. So you need to find out what that is. Maybe you could put a breakpoint in the CloseUp event of the control and then examine the call stack to see what is making it close.
Hi Mike,
Thanks for the response. I would like to also clarify I am using a System.Windows.Form.BindingSource as the DataSource for the UltraCombo.DataSource, and I am changing the BindingSource's DataSource as I fetch new data. The first step is that I set the BindingSource's DataSource = typeof(<MyBusinessObject>), then in an overriden OnEnter I ToggleDropdown(). From here, I can type 2 characters, backspace, etc and it shows the dropdown with no data since the user hasnt typed the 3rd character. Lets say the user then types "Wil" to lookup a name "Williams". On the 3rd character, I fire an asynchronous call to a webservice to get all people that match "Wil", which returns all people that start with "Wil" ("Wilson","Williams", etc). Also, an observation I have made is that if the user is able to type the full text of "Williams" before the asynchronous call completes which changes the BindingSource's DataSource, that the drop down list/grid has not removed entries that start with "Wil" but that dont match the full "Williams", but instead scrolled to "Williams" in the list. If it returns before typing is complete, then as the user types, it removes the non-matching entries from the drop down. Also, from here, with the list visible and no data changes programmatically, if the user types "Williamson", but there are no matching entries, the list disappears. If they backspace back to "Williams", it reappears with the matching results. Also, if they backspace all the way to "W", the list will stay visible since "W" exists in the results. Now, if perhaps they were looking at the wrong name, and they wanted to look for "Smith", as soon as they go back and type "S" the list disapears. None of the data has changed at this point since the last character sequence to populate the data was "Wil". As soon as the user has types "Smi", the call fires to retrieve matching data, but when he call returns and populates the DataSource, the drop down is now hidden and doesnt reappear as text changes, and the user doesnt realize there are matches.
I am sorry if this is long winded, I just wanted to give you as much information as I could. I am new to Infragistics, but if I had to guess, it relates to the filter process. I would like to be able to show an empty drop down grid when there are no matches, instead of losing the drop down.
Thanks again for the help,
Rob Stallworth
Here is basically the code:
public class UltraNameCombo : Infragistics.Win.UltraWinGrid.UltraCombo{ private System.Windows.Forms.BindingSource bs = new System.Windows.Forms.BindingSource(); private string _lookedUpText = string.Empty; public UltraNameCombo() { AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Suggest; bs.DataSource = typeof(MasterName); DataSource = bs; ValueMember = "SurName"; DisplayMember = "SurName"; } protected override void OnEnter(EventArgs e) { ToggleDropdown(); base.OnEnter(e); } protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e) { if (Text.Length == 3 && Text != _lookedUpText) LookupName(); base.OnKeyPress(e); } void LookupName() { _lookedUpText = Text; //create webservice webservice.LookupNameCompleted+=new LookupNameCompletedEventHandler(service_LookupNameCompleted); webservice.LookupNameAsync(_lookedUpText); } void service_LookupNameCompleted(object sender, LookupNameCompletedEventArgs e) { bs.DataSource = e.Result; }}
I guess the question is.. what is causing the dropdown to close. You must be doing something in the code that is triggering the closeup and in order to prevent it, you need to find out exactly what it is.
So what happens when you press backspace and the list gets cleared? My guess is that maybe you are setting the data source to null, rather then simply emptying out the list. But that's only a guess since I don't have any idea what your code might be doing.