Home > Asp.net > Disable Copy/Paste in asp.net textbox

Disable Copy/Paste in asp.net textbox


Sometimes you don’t want to allow user to copy/paste or (Ctrl + C)/(Ctrl + V) in asp.net textbox.

You have to use onCopy=”return false” onPaste=”return false”

Here is an example of that:

<asp:TextBox ID=”tb_Email”  runat=”server”
onCopy=”return false” onPaste=”return false” ></asp:TextBox>

This will restrict user from directly copy/paste into textbox, they have to type manually.

Advertisements
  1. July 7, 2009 at 1:05 pm

    Excellent post. Keep up the good work.
    :Ashish
    http://twitter.com/ashishsalvi

  2. Suman Kumar Singh
    December 23, 2009 at 12:14 pm

    Thnx for help.
    this code is very useful for me.

    Regards,
    Suman Kumar singh

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: