Sunday, 30 September 2012

Disable Copy Paste In Textbox In Asp.Net

If we want to allow users to use right click to copy paste or by using ctrl+C , ctrl+v in textbox on a aspx page in, To disable this we can use javascript
we can achieve this in 2 ways
use Following method If u don't want any alerts or message

If you want to show alerts than use Following method
Right this javascript function in the head section of aspx page, in this function we are disabling right mouse click and ctrl keys

Untitled Page

Now use this function on the textbox which we want to disable copy paste and right clicking

Right click disabled textbox

Ctrl key disabled
Another method
to disable Cut,Copy and paste in textbox

No comments:

Post a Comment