Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 10, 2013 10:14 AM by Pengzhen Song - MSFT
Jan 03, 2013 08:02 PM|LINK
i have a textbox that can have alpha (a-z, A-Z), dash, space and period. I used:
<asp:TextBox ID="tbFirstName" runat="server" CssClass="NormalSmall" Width="170" MaxLength="50" />
<ajaxtoolkit:FilteredTextBoxExtender ID="fteFirstName" runat="server"
But I want to make sure I catch the string that is entirely made up of dash, space and period and does not include alpha.
Jan 03, 2013 08:14 PM|LINK
Then mention only "Custom" in FilterType.
Check this examples for reference..
Jan 03, 2013 08:23 PM|LINK
I can't see how specifying only Custom solves my problem. How do I stop user from specifying " --. .." as name?
"ABC" is valid, "aBc" is valid, "A-b.c " is valid but " - . -" is not (no alpha).
Jan 03, 2013 11:38 PM|LINK
Jan 04, 2013 06:42 PM|LINK
Thanks Shahed. This is an Intranet app and users don;t really have much control over a lot of things, including some browser setting changes. Server side validation was what I was thinking too but thought maybe adding something like a regular expression
validator could come in handy to search for occurence of at least of one alpha character ina addition to those special characters. Trying to avoid a trip to server just to validate a textbox.
Jan 04, 2013 08:34 PM|LINK
How about using a regular expression validator?
Jan 04, 2013 09:02 PM|LINK
That's what I was suggesting but not sure what the expression would look like:
at least on character, from a-z, A-Z, dashes, spaces and periods. This is validating a first/last name so can't start with dash, period or space, can't end with dash and space but can end with period (Someone Jr.)
Jan 10, 2013 10:14 AM|LINK
I try writing the regex expression as follows:
Hope it can help you.