Saturday, 29 December 2012 13:55

how to prevent drag-drop and copy-paste text in textbox

Written by 
Rate this item
(2 votes)

it's needed that you may want to prevent a drag-drop
value from your web page and copy paste text in
your textbox control.this error is reported
most of the time.

you can achieve the solution by the following way -

first your textbox is look like as follows -

<asp:TextBox ID="txtNumber" runat="server"
Width="200">

all you have to do is to add the following javascript
code in the textbox control besides writing many codes-

<asp:TextBox ID="txtNumber" runat="server"
onDrop="blur();return false;" onpaste="return false"
Width="200">

Read 3516 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.
Login to post comments