Feb 11, 2008 #1 bigfoot Programmer May 4, 1999 1,779 US I'm looking for a validation expression that will allow a number in a textbox. I tried this ValidationExpression="[0-9]*\.[0-9]*" But it makes me add the decimal and I want to be able to add an integer if I want. And no spaces. Any help would be great.
I'm looking for a validation expression that will allow a number in a textbox. I tried this ValidationExpression="[0-9]*\.[0-9]*" But it makes me add the decimal and I want to be able to add an integer if I want. And no spaces. Any help would be great.
Feb 11, 2008 1 #2 ca8msm Programmer May 9, 2002 11,327 GB Try looking at http://regexlib.com/ for any Regular Expression issues. They have a "cheat sheet" which should explain how to do what you need. You could also look into using a RangeValidator control if this is for validating data and you want to avoid a RegEx. ------------------------------------------------------- Mark, [URL unfurl="true"]http://aspnetlibrary.com[/url] [URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions [URL unfurl="true"]http://weblogs.asp.net/marksmith[/url] Upvote 0 Downvote
Try looking at http://regexlib.com/ for any Regular Expression issues. They have a "cheat sheet" which should explain how to do what you need. You could also look into using a RangeValidator control if this is for validating data and you want to avoid a RegEx. ------------------------------------------------------- Mark, [URL unfurl="true"]http://aspnetlibrary.com[/url] [URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions [URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
Feb 11, 2008 Thread starter #3 bigfoot Programmer May 4, 1999 1,779 US Thank you. I was out to that site but didn't see the cheat sheet. I was so close. FYI for others. This: ValidationExpression="[0-9]*\.?[0-9]*" or This: ValidationExpression="\d*\.?\d*" This will allow multi decimal points - bad. ValidationExpression="\d*\.*\d*" Upvote 0 Downvote
Thank you. I was out to that site but didn't see the cheat sheet. I was so close. FYI for others. This: ValidationExpression="[0-9]*\.?[0-9]*" or This: ValidationExpression="\d*\.?\d*" This will allow multi decimal points - bad. ValidationExpression="\d*\.*\d*"