Hello All, We are going to start new batch from next week. message/call or mail us for more details.

Disable copy, paste, cut with jQuery in ASP.NET


1. Put :

<script type="text/javascript">2. Inside block script put $(document).ready(function() function<script type="text/javascript">

$(document).ready(function() {
3. Can bind for cut , copy , paste for event handler to target textbox 
<script type="text/javascript">
$(document).ready(function() {

$('#<%=txtTarget.ClientID%>').bind('cut copy paste', // ClinetID properties : Gets the control ID for HTML markup that is generated by ASP.NET

4. Prevent behavior that include "copy, cut, paste " for this textbox
<script type="text/javascript">
$(document).ready(function() {

$('#<%=txtTarget.ClientID%>').bind('cut copy paste',
function(e) { e.preventDefault(); // default behavior disable
5. Showing alert that cut , copy , pastecut , copy , paste is disabled!
<script type="text/javascript">
$(document).ready(function() {

$('#<%=txtTarget.ClientID%>').bind('cut copy paste',
function(e) { e.preventDefault();
alert("cut , copy , paste disable !!!!!");
});
});
</script>

picsample.jpg




1 - put :

<script type="text/javascript">2 - inside block script put $(document).ready(function() function<script type="text/javascript">
$(document).ready(function() {
3 - can bind for cut , copy , paste for event handler to target textbox 
<script type="text/javascript">
$(document).ready(function() {

$('#<%=txtTarget.ClientID%>').bind('cut copy paste', // ClinetID properties : Gets the control ID for HTML markup that is generated by ASP.NET

4 - prevent behavior that include " copy , cut , paste " for this is textbox
<script type="text/javascript">
$(document).ready(function() {

$('#<%=txtTarget.ClientID%>').bind('cut copy paste',
function(e) { e.preventDefault(); // default behavior disable
5 - show alert based on cut , copy , paste disable!
<script type="text/javascript">
$(document).ready(function() {

$('#<%=txtTarget.ClientID%>').bind('cut copy paste',
function(e) { e.preventDefault();
alert("cut , copy , paste disable !!!!!");
});
});
</script>


The End

picsample.jpg

9 comments:

  1. Thanks for your informative blog!!! Your article helped me to understand the future of .net programming language. Keep on updating your with such awesome information. DOT NET Training in Chennai | dot net course Chennai

    ReplyDelete
  2. Thanks for sharing these information. It’s a very nice topic. We are providing online training classes dotnet-online-training

    ReplyDelete
  3. There are so many useful information in your post, I like it all the time. And I want to share this boost app ranking with you, you can take a look. This is very useful.

    ReplyDelete

  4. thank you for giving information its very nice .Net Online Training

    ReplyDelete
  5. I am glad to read this. Thank you for this beautiful content, Keep it up. Techavera is the best VMware training course in Noida. Visit us For Quality Learning.Thank you

    ReplyDelete
  6. Nice article . Thank you for this beautiful content, Keep it up. Techavera is the best
    SAP HANA Training in Noida.
    Visit us For Quality Learning.Thank you

    ReplyDelete