Click here to Skip to main content
14,732,936 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
so that a text box can accept only alphabetics

u can make use f regular expression ^[a-zA-Z]$ it with the text box value....if u r in asp, u can use regular expression validator tool or else jst use regex property in the code behind.
add the belowline in page_load event
textbox.Attributes.Add("onkeypress","return EnsureAlphabets();");

in aspx page add the javascript

function EnsureAlphabet()
{ var k=window.event.keyCode;
{ window.event.returnValue=false;
hi ... above answer is write but u also used ajax control Just download ajax controls lots of control are available just search and download , and use , if u want to used , i used ajax controls .........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900