RadRopDownList add items on the fly

2 posts, 1 answers
  1. Nico
    Nico avatar
    1 posts
    Member since:
    Oct 2012

    Posted 13 Dec 2012 Link to this post

    Hello,

    i fill the list once in the keyDown-event because the list is retrieved from a server. So i load the list when the user first presses a key. But when i set the DataSource-Property of the RadDropDownList, the text is cleared. Any solution for that problem?

    Regards

    Nico
  2. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 18 Dec 2012 Link to this post

    Hi Nico,

    Thank you for the writing.

    This scenario is not typical for RadDropDownList since it is a virtualized control. In other words, a few visual items (for example 5 - 8) can hold a number of logical items.

    Changing the DataSource property is a time-consuming operation, because it fully resets all properties and recreates all items (both logical and visual).

    You should restore the Text, SelectionStart and SelectionLength properties after changing the DataSource. This is required since RadDropDownList syncs its Text with the recreated items.

    I would like to suggest you to set the Filter property instead of resetting the DataSource property. 

    I hope my answer is helpful.

    All the best,
    Peter
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top