This is a migrated thread and some comments may be shown as answers.

MultiColumn ComboBox suggest programmatically

1 Answer 343 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 07 Sep 2018, 10:13 AM

Hello Telerik Team !

On a first hand, I have a form with postcode and city fields.

On a other hand, I have a database, with a table who carry an entire country of codepost/city accordingly.

I turn the postcode into a MultiColumn ComboBox, and the idea is when someone start filling at least 3 char of a post code, programmatically launch a request to the database to fill as both  post code and city like : 

SELECT postcode as [Post Code], city as [City] FROM cityautocomplete where postcode like '" + key + "%'

 

the among query fill a DataTable "postcodeToCity" and I programmatically add the data like this :

ComboPostCode.DataSource = new BindingSource(postcodeToCity, null);
ComboPostCode.DisplayMember = "Post Code";
ComboPostCode.ValueMember = "City";
ComboPostCode.AutoCompleteMode = AutoCompleteMode.Suggest;

 

My problem belongs in the right event to choose to launch the request, TextChanging do not exist, so I have been trying KeyDown, KeyPress & KeyUp without any success, indeed all char entered beyond the first char reset to the beginning. Even if I try to launch the request beyond a minimum length.

The postcode Multi Combo is in Suggest mode only.

So I am wandering if an Events could allow me to achieve this or if I simply try to achieve something impossible with this Control ?

Many thanks in advance if you have any idea or feedback for me !

 

Jeff

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Sep 2018, 10:01 AM
Hello, Jeff,          

RadMultiColumnComboBox hosts the standard MS text box. You can subscribe to the TextChanging event of the hosted editor and thus bind to any collection that you wish considering the user's input:

public RadForm1()
{
    InitializeComponent();
 
    this.radMultiColumnComboBox1.MultiColumnComboBoxElement.TextBoxElement.TextBoxItem.TextChanging += TextBoxItem_TextChanging;
}
 
private void TextBoxItem_TextChanging(object sender, Telerik.WinControls.TextChangingEventArgs e)
{
    //TODO bind to the desired collection
}

If you need any further assistance please don't hesitate to contact me.

Regards,
Dess
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
MultiColumn ComboBox
Asked by
Jeff
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or