Dissable Copy Paste in a ASP.NET Webpage TextBox

Sometimes their is a need to disable the copy paste feature from asp.net text box. This Blog provides you details about how to disable copy paste feature in a TextBox. However you can use it for div, paragraph tag, form tag and so on which is applicable.

Use this code in your .aspx page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="disablingcopypastefeatureintextbox.aspx.cs"

    Inherits="disablingcopypastefeatureintextbox" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <%--added by vithal wadje--%>

    <div>

        <asp:TextBox ID="TextBox1" runat="server" oncopy="return false" onpaste="return false"

            oncut="return false">

        </asp:TextBox>

      

    </div>

    </form>

</body>

</html>

 

Ebook Download
View all
Learn
View all