DropDown List Showing items already selected

2 posts, 0 answers
  1. Ílson
    Ílson avatar
    1 posts
    Member since:
    Oct 2014

    Posted 29 Oct 2014 Link to this post


    The RadAutoCompleteBox allows me to select items that were already selected.
    That way it allows the user to duplicate items selected.

    I't happens the same way on that sample http://demos.telerik.com/aspnet-ajax/autocompletebox/examples/default/defaultcs.aspx

    When i press 'n' and select Nancy. It goes to the box.
    Then i press 'n' and select Nancy again. The i get 2 Nancyes on the box.

    Is it expected?
    Can i prevent it from showing selected items on the Drop Down?

    Thanks in advance.
  2. Nencho
    Nencho avatar
    1646 posts

    Posted 03 Nov 2014 Link to this post

    Hello Ílson,

    You could prevent the items from displaying in the dropdown, by performing the appropriate query to the underlying datasource and excluding those fields, which matches to the text  of the already added entries. For this purpose, you could use the OnDataSourceSelect event of the RadAutoCompleteBox :


    Another approach you could use is to prevent the selection of the certain Item, if an entry with the same text (or value) is already selected. This could be achieved at the OnClientEntryAdding client-side event of the control and by canceling its propagation if a match is found :

    <script type="text/javascript">
    function OnClientEntryAdding (sender, eventArgs) {
        var entries = sender.get_entries(),
        count = entries.get_count();   
        for (var i = 0; i < count; i++) {          
            if(entries.getEntry(i).get_text() == eventArgs.get_entry().get_text())


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top