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

Load On Demand for WinForms

9 Answers 280 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sean
Top achievements
Rank 1
Sean asked on 27 May 2009, 08:10 PM
Hello,
After working extensively with the controls for ASP.NET, I am new to the WinForm controls.  What I am looking for is a way to enable the "load on demand" functionality that is present in the Telerik radComboBox for ASP.NET. 

I have a web service that I would like to use to dynamically load data in a combobox.  So when the user types in some data (like "ab", I will call the webservice to find all matching items and then display them in the combobox).  This is very easy to accomplish in ASP.NET, but I have been searching the forums and struggling with this for several days. 

Here is the code that I have so far.  This pretty much gets me what I need, but sometimes the drop down does not display the items that were loaded from the web service (I can even step through the code and see that the .Items.Count property of the combo is greater than zero, but still no drop down).

 
    Private Sub DescriptionComboBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)  
        Dim descriptionComboBoxEditor As RadComboBoxEditor = New RadComboBoxEditor  
        Dim newDescription As String = Nothing 
        Dim pdHelperWebService As New pdhelper.PDHelper  
        Dim ds As DataSet  
        Dim dt As DataTable  
        Dim filter As String = Nothing 
        Dim comboItem As RadComboBoxItem  
 
        descriptionComboBoxEditor = CType(sender, RadComboBoxEditor)  
        descriptionComboBoxEditor.AutoCompleteMode = AutoCompleteMode.None  
        newDescription = descriptionComboBoxEditor.Text  
 
       descriptionComboBoxEditor.Items.Clear()  
          
       If Not String.IsNullOrEmpty(newDescription) AndAlso newDescription.Length >= 3 Then  
 
            'Call the webservice  
             ds = myWebService.GetItems(newDescription)  
             dt = ds.Tables("MY_RESULTS")  
 
            'Add each item to the combobox  
            For Each item As DataRow In dt.Rows  
 
                comboItem = New RadComboBoxItem  
                comboItem.Text = item("DESCRIPTION")  
                comboItem.Value = item("DESCRIPTION")  
 
                If Not (TypeOf (item("TOOLTIP")) Is DBNull) AndAlso _  
                    item("TOOLTIP") IsNot Nothing Then  
 
                    comboItem.ToolTipText = item("TOOLTIP")  
 
                End If  
 
                descriptionComboBoxEditor.Items.Add(comboItem)  
 
            Next  
 
            'Show the drop down if it's not already shown  
            If Not descriptionComboBoxEditor.IsPopupOpen Then  
 
                descriptionComboBoxEditor.ShowPopup()  
 
            End If  
 
        End If  
 
        pdHelperWebService.Dispose()  
 
    End Sub 

Is there a better way to handle this?  Is this functionality supported out of the box?  Any help is greatly appreciated.

Thanks,
Sean

9 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 28 May 2009, 07:12 AM
Hi Sean,

Thank you for contacting us. Another our ASP.NET customer has recently asked about this feature in WinForms and unfortunately we do not have it build-in in our WinForms combobox, hence, writing a work-around is the best thing that you can do.

I hope this answers your question. Do not hesitate to write me back if you have further questions. 

Sincerely yours,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sean
Top achievements
Rank 1
answered on 28 May 2009, 11:06 AM

Thanks for the reply Nick. 

Do you have an example of a workaround or can you help me with my problem of the drop down not displaying?  Should I be adding/removing items in the TextChanged event, or is there another event that I need to handle?

 

Thanks,

Sean

0
Nick
Telerik team
answered on 28 May 2009, 02:21 PM
Hello Sean,

TextChanging is the only suitable event because you need to track changes in the textbox portion of RadComboBox control. Essentially what you want to achieve is something similar to the search bar of your browser. The main problem is opening the dropdown to show the just filtered values based on the written text and we currently do not have a work-around about that.  

All the best,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sean
Top achievements
Rank 1
answered on 15 Jun 2009, 08:46 PM
I have tried to workaround this issue on and off for the past few weeks, but I have not found a solution.  The load-on-demand functionality was initially something that was deemed "nice to have" for the application that I am working on, but now it has been upgraded by the powers that be to a "must have".  Are there any solutions to the issue with the drop down?  Do I need to submit a support ticket?

Thanks,
Sean
0
Nick
Telerik team
answered on 16 Jun 2009, 06:51 AM
Hello Sean,

Thank you for contacting us. Currently we do not have plans to expand combobox functionality for Q2 2009 since there are just few weeks left. However, we will definitely consider this feature when we evaluate its priority for our next release Q3 2009. We determine features priority based on the demand for them across our customers.

All the best,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sean
Top achievements
Rank 1
answered on 16 Jun 2009, 02:03 PM
I understand that the out of the box load on demand feature is not feasible in a short timeframe.  In the example that I uploaded I have wired-up the combobox to load the data from a web service.  Everything works great for the initial load, but on subsequent calls the the drop down portion of the combobox does not display.  Is there anything that I can do to workaround this issue?

Thanks,
Sean
0
Accepted
Nick
Telerik team
answered on 22 Jun 2009, 07:56 AM
Hi Sean,

We have prepared for you an application which demonstrates how RadComboBox can be customized in order to address the issue. The attached project contains a RadComboBox item which is bind to a list of countries. The drop-down list of RadComboBox is filtered when the TextChanged() event occurs. Thus the drop-down list shows only the countries that match the input.

Please note that to access that behavior we have set the Virtualization mode of the RadComboBox to false. For further information about Virtualization please refer to this article.

We hope this will solve the issue. If you need further assistance, do not hesitate to contact us.

Best wishes,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sean
Top achievements
Rank 1
answered on 23 Jun 2009, 06:31 PM
Nick,
The "Virtualized" property was the issue.  I ended up needing to have my combobox embedded in a grid, so I used the  GridMultiColumnComboBox.  I had to make a few other tweaks, but you got me on the right path.  Thanks for your help! 

Sean
0
Sean
Top achievements
Rank 1
answered on 15 Jul 2009, 08:51 PM
For anyone who may be interested, I posted my solution (using the RadGridView) to the Code Library.

http://www.telerik.com/community/code-library/winforms/gridview/load-on-demand-combobox-for-radgridview.aspx

Thanks,
Sean
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Sean
Top achievements
Rank 1
Answers by
Nick
Telerik team
Sean
Top achievements
Rank 1
Share this question
or