Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 11, 2012 12:26 AM by mohammed.kamran.azam
Participant
1128 Points
1307 Posts
May 11, 2012 12:14 AM|LINK
Hello,
I am using the following regular expression to enter values from 0 to 100.
Unfortunately it is not allowing me to enter 100.
Any suggestions ?
ValidationExpression="\d{0,2}(\.\d{1,2})?"
All-Star
35998 Points
6551 Posts
May 11, 2012 12:26 AM|LINK
Simply use a RangeValidator instead!
<asp:TextBox ID="TextBox1" runat="server" /> <asp:RangeValidator ControlToValidate="TextBox1" ErrorMessage="TextBox1 must be between 0 and 100" ID="RangeValidator1" MaximumValue="100" MinimumValue="0" runat="server" Text="*" Type="Integer" />
http://msdn.microsoft.com/en-us/library/f70d09xt.aspx
Member
139 Points
92 Posts
^-?[0-9]{0,2}(\.[0-9]{1,2})?$|^-?(100)(\.[0]{1,2})?$
or
^100$|^100.00$|^\d{0,2}(\.\d{1,2})? *?$
^(100(\.0{0,2}?)?$|([1-9]|[1-9][0-9])(\.\d{1,2})?)$
ramll
Participant
1128 Points
1307 Posts
Validation Expression to enter maximum of 100
May 11, 2012 12:14 AM|LINK
Hello,
I am using the following regular expression to enter values from 0 to 100.
Unfortunately it is not allowing me to enter 100.
Any suggestions ?
ValidationExpression="\d{0,2}(\.\d{1,2})?"hans_v
All-Star
35998 Points
6551 Posts
Re: Validation Expression to enter maximum of 100
May 11, 2012 12:26 AM|LINK
Simply use a RangeValidator instead!
<asp:TextBox ID="TextBox1" runat="server" /> <asp:RangeValidator ControlToValidate="TextBox1" ErrorMessage="TextBox1 must be between 0 and 100" ID="RangeValidator1" MaximumValue="100" MinimumValue="0" runat="server" Text="*" Type="Integer" />http://msdn.microsoft.com/en-us/library/f70d09xt.aspx
mohammed.kam...
Member
139 Points
92 Posts
Re: Validation Expression to enter maximum of 100
May 11, 2012 12:26 AM|LINK
^-?[0-9]{0,2}(\.[0-9]{1,2})?$|^-?(100)(\.[0]{1,2})?$or^100$|^100.00$|^\d{0,2}(\.\d{1,2})? *?$or^(100(\.0{0,2}?)?$|([1-9]|[1-9][0-9])(\.\d{1,2})?)$OWDARO