To block all key pressed using javascript in asp.net add the vb code that will execute at client side when any key will be pressed .
txt.Attributes.Add("onkeydown", "return RestrictAllKey();")
Add the javascript function when all key is to be blocked
Following code will block the ; to be pressed
function RestrictAllKey()
{
return false;
}
Add following function when a particular key pressed is to be blocked
function RestrictEntry()
{
var keyCode=window.event.keyCode;
if(window.event.keyCode==186)
return false;
else
{
return true;
}
}
txt.Attributes.Add("onkeydown", "return RestrictAllKey();")
Add the javascript function when all key is to be blocked
Following code will block the ; to be pressed
function RestrictAllKey()
{
return false;
}
Add following function when a particular key pressed is to be blocked
function RestrictEntry()
{
var keyCode=window.event.keyCode;
if(window.event.keyCode==186)
return false;
else
{
return true;
}
}