Click here to Skip to main content
16,022,352 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
textbox only allow letter....... show the code in c#
text only allow alphanumeric same in c#

What I have tried:

just tell me the code in c#asp.net
Posted
Updated 13-Jul-16 21:45pm
Comments
Suvendu Shekhar Giri 14-Jul-16 3:25am    
Is it a windows application or web application?
What have you tried so far?

Google is your friend. See for instance c# - How do I make a textbox that only accepts numbers? - Stack Overflow[^]. While not exactly solving your problem, the first answer illustrates the technique.
 
Share this answer
 
For ASP.NET you don't want to do it in C# - you want to do it in JavaScript so that the user can't enter "bad" info. Doing it in C# means a round trip to the server either when the user is finished with the whole form, or for each character. The former is a pain for the user as they get told at the end "that was wrong" and have to go back to fix it, the latter is slow and awkward. Using JS means it's done at the client end and the server isn't involved.
Javascript validation: Validate TextBox using JavaScript[^]
 
Share this answer
 

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