How to Prevent users from pasting data into RadComboBox?

2 posts, 0 answers
  1. Prasad
    Prasad avatar
    8 posts
    Member since:
    Feb 2012

    Posted 23 Apr 2012 Link to this post

    Hi All,

    Markup of my radcombobox looks like the following. Even with the following configuration, users are able to paste invalid data into RadComboBox. Can someone please let me know a way to prevent that?

    <telerik:RadComboBox ID="rcbDepartment" runat="server"  Width="200px"
               EmptyMessage="Any Department"  DataTextField="text" DataValueField="value"
               AutoCompleteSeparator=";"  AllowCustomText="false"
               MarkFirstMatch="true"  > </telerik:RadComboBox>        
  2. Ivana
    Ivana avatar
    657 posts

    Posted 26 Apr 2012 Link to this post

    Hello Prasad,

    Here is what you can try to overcome this behavior:
    function clientLoad(sender, args) {
        var input = sender.get_inputDomElement();
        input.addEventListener("paste", pasteHanlder);
    function pasteHanlder(e) {
        return false;
    <telerik:RadComboBox ID="rcbDepartment" runat="server" Width="200px" EmptyMessage="Any Department"
        DataTextField="text" DataValueField="value" AutoCompleteSeparator=";" AllowCustomText="false"
        MarkFirstMatch="true" OnClientLoad="clientLoad">
            <telerik:RadComboBoxItem Text="item1" />
            <telerik:RadComboBoxItem Text="item2" />

    I hope this helps.

    All the best,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top