RadCombo Invalid Selection

4 posts, 0 answers
  1. DK
    DK avatar
    72 posts
    Member since:
    Jun 2009

    Posted 23 Aug 2009 Link to this post

    Hi
    I have a combox in which allow cutom text= true.
    now when user type something in it i want to check if the entered value exits in the  combox items or not. i want  to check it client side.

    i have tried it by using on blur event of the combobox but sometimes it goes in infinite lop.
    please help me in this regard
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Aug 2009 Link to this post

    Hello,

    Have you tried following approach to check whether the entered text exists in RadComboBox item collection?

    ASPX:
     
    <telerik:RadComboBox ID="RadComboBox1" runat="server" Skin="WebBlue" 
        AllowCustomText="True" MarkFirstMatch="false" OnClientBlur="OnClientBlur">  
        <Items> 
            <telerik:RadComboBoxItem Text="Item1" runat="server" /> 
            <telerik:RadComboBoxItem Text="Item2" runat="server" /> 
            <telerik:RadComboBoxItem Text="Item3" runat="server" /> 
        </Items> 
    </telerik:RadComboBox> 
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 

    JavaScript:
     
    <script type="text/javascript">  
    function OnClientBlur(sender, eventArgs)  
    {  
        var item = sender.findItemByText(sender.get_text());  
        var lbl = document.getElementById("Label1");  
        if(item == null)  
        {  
           lbl.innerText = "Not in list";  
        }  
        else 
        {  
           lbl.innerText = "Found";  
        }  
    }  
    </script> 

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 24 Aug 2009 Link to this post

    Hello DK,

    You could do what Princy suggested in the client-side TextChange as well. In this way the check will be made more often rather than just on loosing focus.

    Kind regards,
    Simon
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  5. David McClelland
    David McClelland avatar
    9 posts
    Member since:
    Oct 2012

    Posted 15 Oct 2012 Link to this post

    I found that merikmgrasp's solution using OnClientDropDownClosed seemed to work the best for me.
Back to Top