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

Disable Copy/Paste/Cut and Enable alphanumeric data only

3 Answers 185 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Herman Gouw
Top achievements
Rank 2
Herman Gouw asked on 03 Feb 2011, 06:59 AM
On my web page, I have 2 RadComboBox with AllowCustomText set to True.

Can you please tell me how to:
1. disable Copy and Paste on RadComboBox
2. allow ONLY alphanumeric characters to be entered on RadComboBox.

PS: I am using Telerik RadControls for ASP.NET AJAX Q3 2010.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Feb 2011, 12:27 PM
Hello Herman,

You can achieve the requirements by subscribing OnClientKeyPressing event of the RadComboBox. There you can check for the keycode and can handle the event.

Here is a documentation which explains more on this.
http://www.telerik.com/help/aspnet-ajax/combo_clientsideonclientkeypressing.html

Thanks,
Shinu.
0
Herman Gouw
Top achievements
Rank 2
answered on 04 Feb 2011, 04:35 AM
Hi Shinu,

Thanks for your reply.

According to http://www.telerik.com/help/aspnet-ajax/combo-prevent-typing-particular-characters.html, OnClientKeyPressing event cannot be cancelled. Therefore, I cannot use OnClientKeyPressing to prevent typing certain characters.

I tried to implement the solution given in http://www.telerik.com/help/aspnet-ajax/combo-prevent-typing-particular-characters.html. But I got an error. The error message is given on http://img689.imageshack.us/img689/1797/viewdataaccess.jpg

The ASPX is given on http://www.keepandshare.com/doc/2572320/viewdataaccess-pdf-february-3-2011-9-27-pm-26k?da=y

Basically, what I want to achieve are:
1. prevent the users from entering non alphanumeric characters on the RadComboBox
2. prevent the users from copy and paste any characters on to the RadComboBox

Regards,
Herman
0
Shinu
Top achievements
Rank 2
answered on 04 Feb 2011, 08:55 AM
Hello Herman,

You can try wrapping the script in a RadCodeBlock control like below.
javascript:
<telerik:RadScriptBlock ID="scriptBlock" runat="server">
         <script type="text/javascript">
         </script>
</telerik:RadScriptBlock>

Thanks,
Shinu.
Tags
ComboBox
Asked by
Herman Gouw
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Herman Gouw
Top achievements
Rank 2
Share this question
or