Regular Expression Validator to validate numeric range in ASP.Net

nid@patel
 
on Dec 01, 2019 11:26 PM
Sample_106519.zip
2845 Views

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

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Dec 02, 2019 04:33 AM

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" />