Pages

Friday 17 October 2014

how to prevent copy-paste of a textbox in a web application



//java script
<script type="text/javascript">
         $(document).ready(function () {
             $('#TextBox1').bind('copy paste cut', function (e) {
                 e.preventDefault(); //disable cut,copy,paste
                 alert('cut,copy & paste options are disabled !!');
             });
         });
</script>

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