locked
Error - Range 0 to 100 RRS feed

  • Question

  • User-1499457942 posted

    Hi

        I have value 50.00 but still it is giving error Range 0 to 100.

    <asp:TextBox ID="txt_Ratio" CssClass="form-control" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="rev2" runat="server" ErrorMessage="Value can consist of Numeric Digits Only!" Display="Dynamic" ToolTip="Enter Numeric Digits Only
                    " ControlToValidate="txt_Ratio" ValidationExpression="^([1-9]\d*|0)(\.\d{1,2})?$"></asp:RegularExpressionValidator>
                    <asp:RangeValidator ID="rv2" CssClass="Validators" Display="Dynamic" MinimumValue="0" MaximumValue="100" Type="Integer" ControlToValidate="txt_Ratio"
                    runat="server" ErrorMessage="Range 0 to 100"></asp:RangeValidator>

    Thanks

    Friday, October 12, 2018 4:10 PM

Answers

  • User998287339 posted

    Change the Type from "Integer" to "double". Hopefully this should help.

    <asp:TextBox ID="txt_Ratio" CssClass="form-control" runat="server"></asp:TextBox>
                   
    <asp:RegularExpressionValidator ID="rev2" runat="server" ErrorMessage="Value can consist of Numeric Digits Only!" Display="Dynamic" ToolTip="Enter Numeric Digits Only " ControlToValidate="txt_Ratio" ValidationExpression="^([1-9]\d*|0)(\.\d{1,2})?$"></asp:RegularExpressionValidator>
                   
    <asp:RangeValidator ID="rv2" CssClass="Validators" Display="Dynamic" MinimumValue="0" MaximumValue="100" Type="double" ControlToValidate="txt_Ratio"
                   
    runat="server" ErrorMessage="Range 0 to 100"></asp:RangeValidator>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 12, 2018 4:41 PM