write the code on jscript page:-
function ValidateAlpha()
{
var keyCode = window.event.keyCode;
if ((keyCode < 65 || keyCode > 90) && (keyCode < 97 || keyCode > 123) && keyCode != 32)
{
window.event.returnValue = false;
alert("Enter only letters");
}
}
Call the function on textbox:-
<asp:TextBox ID="TextBox5" runat="server" onKeyPress="ValidateAlpha();"></asp:TextBox>
No comments:
Post a Comment