Load On Demand for WinForms

10 posts, 1 answers
  1. Sean
    Sean avatar
    79 posts
    Member since:
    May 2007

    Posted 27 May 2009 Link to this post

    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
  2. Nick
    Admin
    Nick avatar
    767 posts

    Posted 28 May 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Sean
    Sean avatar
    79 posts
    Member since:
    May 2007

    Posted 28 May 2009 Link to this post

    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

  5. Nick
    Admin
    Nick avatar
    767 posts

    Posted 28 May 2009 Link to this post

    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.
  6. Sean
    Sean avatar
    79 posts
    Member since:
    May 2007

    Posted 15 Jun 2009 Link to this post

    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
  7. Nick
    Admin
    Nick avatar
    767 posts

    Posted 16 Jun 2009 Link to this post

    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.
  8. Sean
    Sean avatar
    79 posts
    Member since:
    May 2007

    Posted 16 Jun 2009 Link to this post

    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
  9. Answer
    Nick
    Admin
    Nick avatar
    767 posts

    Posted 22 Jun 2009 Link to this post

    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.
  10. Sean
    Sean avatar
    79 posts
    Member since:
    May 2007

    Posted 23 Jun 2009 Link to this post

    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
  11. Sean
    Sean avatar
    79 posts
    Member since:
    May 2007

    Posted 15 Jul 2009 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready