autocomplete radcombobox on blur

2 posts, 0 answers
  1. Loyal User
    Loyal User avatar
    37 posts
    Member since:
    Apr 2012

    Posted 08 Jul 2014 Link to this post

    i use this demo to create an autocomplete radcombobox, what i want is to select first item on blur and get its text ;

     combobox contains country code :
    e.i.: when a user enter 908123 , i want to select '908 country name ' on blur event
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 08 Jul 2014 in reply to Loyal User Link to this post


    I guess that you want to select the first Item from the dropdown based on the text in the RadComboBox. Please have a look into the sample code snippet which works fine at my end.

    <telerik:RadComboBox ID="RadComboBox1" runat="server" EmptyMessage="Type an E-mail"
        AllowCustomText="true" DataSourceID="SqlDataSource1" DataTextField="ContactName"
        MarkFirstMatch="true" OnClientBlur="selectItem">

    function selectItem(sender, args) {
        var firstChar = sender.get_text().charAt(0);
        var i, count = sender.get_items().get_count();
        for (var i = 0; i < count; i++) {
            if (sender.get_items().getItem(i).get_text().startsWith(firstChar)) {

Back to Top