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

RadCombo Invalid Selection

3 Answers 81 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
DK
Top achievements
Rank 2
DK asked on 23 Aug 2009, 11:10 AM
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

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Aug 2009, 05:52 AM
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.
0
Simon
Telerik team
answered on 24 Aug 2009, 03:31 PM
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.
0
David McClelland
Top achievements
Rank 1
answered on 15 Oct 2012, 02:56 PM
I found that merikmgrasp's solution using OnClientDropDownClosed seemed to work the best for me.
Tags
ComboBox
Asked by
DK
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Simon
Telerik team
David McClelland
Top achievements
Rank 1
Share this question
or