Hi friends,in this article i will explain about JQuery:How to Disable Cut,Copy and Paste in ASP.NET.
I already explained in the previous articles about JQuery:Select Multiple records in GridView with Ctrl Key in ASP.NET using C#/VB.NET,TextBox AutoComplete using JQuery or JSON in ASP.NET,How to Validate Date in Different(Any) formats using C#.NET/VB.NET and JQuery:How to get GridView Cell Data in ASP.NET using C#/VB.NET
ASP.NET: Previous Article>>Copy and Paste User Selected TextKey
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"
runat="server">
<title>JQuery:How
to Disable Cut,Copy and Paste in ASP.NET</title>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.4.min.js">
</script>
<script type="text/javascript" language="javascript">
///First Way
$(document).ready(function () {
$('#txtDisable').live("cut
copy paste", function (e) {
e.preventDefault();
});
});
///Second Way
$(document).ready(function () {
$('#txtSecond').bind("cut
copy paste", function (e) {
e.preventDefault();
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>JQuery:How
to Disable Cut,Copy and Paste in ASP.NET</h3>
<span>Disable
Cut,Copy and Paste using live() method</span><br />
<asp:TextBox ID="txtDisable" runat="server"></asp:TextBox><br />
<span>Disable Cut,Copy and Paste using bind() method</span><br />
<asp:TextBox ID="txtSecond" runat="server"></asp:TextBox><br />
<%-- Third Way--%>
<span>Disable
Cut,Copy and Paste using oncopy,oncut and onpaste by giving return false</span><br />
<asp:TextBox ID="txtThird" runat="server" oncopy="return false;" oncut="return false;"
onpaste="return
false;"></asp:TextBox>
</form>
</body>
</html>
|
Live Demo:
Previous Article>> Copy and Paste User Selected Text
"If you like my blog or articles, you can appreciate by leaving your comments or Liking my Facebook pageAspdotnet-kishore, following on Google+ Aspdotnet-Kishore, Twitter on AspdotnetKishore, Linked in Aspdotnet-Kishore, stumbling my posts on stumble upon and subscribing on RSSfeed Aspdotnet-Kishore for free updates directly to your Email inbox . Watch my blog for more articles."
No comments:
Post a Comment