1. Use This JS
function validateAlphanumeric(e)
{
var key;
if(window.event)
{
key = window.event.keyCode; //IE
}
else
{
key = e.which; //firefox
}
if (!((key >64 && key <=90) ||(key >96 && key <=122) ||( key ==32) ||(key >47 && key <=57) || ( key ==8)||( key == 0)||(key==127)))
{
return false;
}
else return true;
}
2. Define your textbox as
<asp:Textbox is="myTxtBox" runat="server" onkeypress="return validateAlphanumeric(this);">
No comments:
Post a Comment