You can do this with javascript to filter out which characters you accept, but if you can use Asp.net AJAX, you can add FilteredTextBoxExtender to the text box and only allow uppercase letters and / or lowercase letters.
To add FilteredTextBoxExtender to Visual Studio 2008, you can do the following:
- browse the page in design mode and find the text box
- click the arrow on the right side of the text box to open the Text Box Tasks menu and select Add Expander.
- Then select FilteredTextBoxExtender and click OK.
- Your text box should now have a new property available in the designer. Make sure the text box is selected and press F4 to open the property constructor.
- Find a new property in the property designer. It should be called YOURTEXTBOXNAME_FilteredTextBoxExtender. Find the FilterType property and select UppercaseLetters or LowercaseLetters.
- If you need upper and lower case letters, you must edit the markup directly and set its value to "Upper case, lower case"
Rune Grimstad May 6 '09 at 6:53 a.m. 2009-05-06 06:53
source share