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

RadRopDownList add items on the fly

1 Answer 110 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Nico
Top achievements
Rank 1
Nico asked on 13 Dec 2012, 03:34 PM
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

1 Answer, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 18 Dec 2012, 02:19 PM
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.
Tags
DropDownList
Asked by
Nico
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or