Saturday, May 23, 2009

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.

0 comments: