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

21 comments:

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

    ReplyDelete

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

    ReplyDelete
  3. 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
  4. Great article, Thankyou for sharing. You can also visit: .Net Training in scarborough

    ReplyDelete
  5. Good Post. Thanks for sharing great post.

    If you want to logo designing services than visit - Logo Designing Services Jaipur | Logo Designer in Jaipur | Logo maker in Jaipur

    ReplyDelete

  6. It was really a nice post and I was really impressed by reading this keep updating
    Nice work, your blog is concept-oriented, kindly share more blogs like this
    Excellent Blog, I appreciate your hard work, it is useful
    Visual studio training

    ReplyDelete
  7. Thanks for sharing such a great blog Keep posting.. 
    VMware Training in Delhi

    ReplyDelete
  8. It was so nice article.I was really satisfied by seeing this article.Dot Net Training in Bangalore

    ReplyDelete
  9. Fantastic blog and great design and style. Good write-up, I am regular visitor of one’s website, maintain up the nice operate, and It’s going to be a regular visitor for a long time.

    무료야설
    대딸방
    횟수 무제한 출장
    스포츠마사지
    바카라사이트

    ReplyDelete
  10. I like the efforts you have put in this, appreciate it for all the great blog posts. 온라인경마


    ReplyDelete
  11. Like!! I blog quite often and I genuinely thank you for your information. The article has truly peaked my interest. 릴게임

    ReplyDelete