RangeValidator not checking the RANGE?

Discussion in 'ASP .Net' started by D. Shane Fowlkes, Feb 9, 2004.

  1. This seems simple enough but why can't I get it to check the input BETWEEN
    the two ranges I specify? If I set the Min value to 1 and the Max to 10, it
    will ONLY validate 1 OR 10....not 2 thru 9. Weird? I must be doing
    something wrong.

    TIA.

    My test page:

    http://www.drumpub.com/test.aspx


    My code:

    <form runat="server">
    <asp:TextBox ID="txtQuantity" runat="server" MaxLength="5" Columns="5" />
    <asp:RangeValidator ControlToValidate="txtQuantity" id="QuantityValidator"
    runat="server" Font-Bold="true" Font-Size="10" MinimumValue="1"
    MaximumValue="10">*Quantity must be between 1 and 10.</asp:RangeValidator>
    <asp:Button ID="btnSubmit" runat="server" Text="I'm Done. Submit It." />
    </form>
    D. Shane Fowlkes, Feb 9, 2004
    #1
    1. Advertising

  2. D. Shane Fowlkes

    Joe Gass Guest

    you need
    "D. Shane Fowlkes" <> wrote in message
    news:%...
    > This seems simple enough but why can't I get it to check the input BETWEEN
    > the two ranges I specify? If I set the Min value to 1 and the Max to 10,

    it
    > will ONLY validate 1 OR 10....not 2 thru 9. Weird? I must be doing
    > something wrong.
    >
    > TIA.
    >
    > My test page:
    >
    > http://www.drumpub.com/test.aspx
    >
    >
    > My code:
    >
    > <form runat="server">
    > <asp:TextBox ID="txtQuantity" runat="server" MaxLength="5" Columns="5" />
    > <asp:RangeValidator ControlToValidate="txtQuantity" id="QuantityValidator"
    > runat="server" Font-Bold="true" Font-Size="10" MinimumValue="1"
    > MaximumValue="10">*Quantity must be between 1 and 10.</asp:RangeValidator>
    > <asp:Button ID="btnSubmit" runat="server" Text="I'm Done. Submit It." />
    > </form>
    >
    >
    >

    you need to specify Type="Integer"

    e.g.
    <asp:RangeValidator ControlToValidate="txtQuantity" id="QuantityValidator"
    Type="Integer"
    runat="server" Font-Bold="true" Font-Size="10" MinimumValue="1"
    MaximumValue="10">
    Joe Gass, Feb 9, 2004
    #2
    1. Advertising

  3. D'oh! Thanks.


    "Joe Gass" <> wrote in message
    news:...
    > you need
    > "D. Shane Fowlkes" <> wrote in message
    > news:%...
    > > This seems simple enough but why can't I get it to check the input

    BETWEEN
    > > the two ranges I specify? If I set the Min value to 1 and the Max to

    10,
    > it
    > > will ONLY validate 1 OR 10....not 2 thru 9. Weird? I must be doing
    > > something wrong.
    > >
    > > TIA.
    > >
    > > My test page:
    > >
    > > http://www.drumpub.com/test.aspx
    > >
    > >
    > > My code:
    > >
    > > <form runat="server">
    > > <asp:TextBox ID="txtQuantity" runat="server" MaxLength="5" Columns="5"

    />
    > > <asp:RangeValidator ControlToValidate="txtQuantity"

    id="QuantityValidator"
    > > runat="server" Font-Bold="true" Font-Size="10" MinimumValue="1"
    > > MaximumValue="10">*Quantity must be between 1 and

    10.</asp:RangeValidator>
    > > <asp:Button ID="btnSubmit" runat="server" Text="I'm Done. Submit It." />
    > > </form>
    > >
    > >
    > >

    > you need to specify Type="Integer"
    >
    > e.g.
    > <asp:RangeValidator ControlToValidate="txtQuantity" id="QuantityValidator"
    > Type="Integer"
    > runat="server" Font-Bold="true" Font-Size="10" MinimumValue="1"
    > MaximumValue="10">
    >
    >
    D. Shane Fowlkes, Feb 9, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?dGNi?=
    Replies:
    1
    Views:
    755
    Ashish M Bhonkiya
    Apr 27, 2004
  2. Johannes Hammersen

    RangeValidator Minimum Date can not be 01.01.0001

    Johannes Hammersen, Nov 22, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    5,228
    Johannes Hammersen
    Nov 23, 2004
  3. Lucas Tam

    Help: RangeValidator Not Working!

    Lucas Tam, Jan 31, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    930
    =?Utf-8?B?S29zdGFkaW4gS29zdG92?=
    Jan 31, 2005
  4. Replies:
    3
    Views:
    1,818
    Brock Allen
    Mar 29, 2005
  5. Replies:
    1
    Views:
    323
    Chineme Nnamdi
    May 9, 2006
Loading...

Share This Page