Disable cut/copy/paste operations on an ASP.NET Textbox

Updated on     Kisan Patel

In this post, let’s see how to disable cut/copy/paste operations on an ASP.NET TextBox. When requesting sensitive information from the end user such as passwords, credit card details, and transaction pin numbers used in Internet banking, etc. it is preferred that the web user keys in the characters manually rather than pasting from the clipboard.

First create a new web form DisableCopy.aspx to the current project.

Now add following TextBox from the toolbox in asp.net web form page:

<asp:TextBox ID="txt_Password" Width="200px" runat="server" TextMode="Password"></asp:TextBox>

Now use following jQuery to disbale cut/copy/paste operations on an ASP.NET Textbox-

<script type="text/javascript">
$(document).ready(function() {
    $('#<%=txt_Password.ClientID%>').bind('cut copy paste', function(e) {
      alert("Cut / Copy / Paste disabled in this textbox");

Run the web page. Try cut/copy/paste operations on the Password fields. The page will throw the information message.


Leave a Reply