Regular Expression Validator to validate numeric range in ASP.Net

Last Reply 4 months ago By dharmendr

Posted 4 months ago

what will be the validation expression in regular expression validator for range between 30 to 360 and the range between 20 to 240?

Posted 4 months ago

Hi nid@patel,

Instead of using RegularExpressionValidator use RangeValidator.

Check the example.

<asp:TextBox runat="server" ID="txtNumber" />
<asp:RangeValidator ErrorMessage="Range must be between 30 and 360" ControlToValidate="txtNumber" runat="server"
    MaximumValue="360" MinimumValue="30" />