Archive

Posts Tagged ‘disable’

Validator Enable/Disable in Asp.net using Javascript

February 3, 2010 Leave a comment

You can enable/disable validators using javascript as follows:

ValidatorEnable(document.getElementById(‘<%= rfv.ClientID %>’), false);

First argument is id of validator, second argument is to enable pass “true”, else pass “false”.

Advertisements

Disable Copy/Paste in asp.net textbox

May 23, 2009 2 comments

Sometimes you don’t want to allow user to copy/paste or (Ctrl + C)/(Ctrl + V) in asp.net textbox.

You have to use onCopy=”return false” onPaste=”return false”

Here is an example of that:

<asp:TextBox ID=”tb_Email”  runat=”server”
onCopy=”return false” onPaste=”return false” ></asp:TextBox>

This will restrict user from directly copy/paste into textbox, they have to type manually.