how to restrict......

Discussion in 'ASP .Net' started by atif, Jan 13, 2004.

  1. atif

    atif Guest

    I hav a prob with the textfield i want to restrict this field so that
    only integer values should b entered e.g 0-9 n no english or special
    characters should b entered in the text field


    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    ----------------------------------------------------------
    http://www.usenet.com
    atif, Jan 13, 2004
    #1
    1. Advertising

  2. atif

    Hermit Dave Guest

    use a regular expression validation control ?

    with expression like
    \d{5,20}


    or you could also use range validator...

    specify it as integer or double and specify the range and control you wish
    to check...

    --
    Regards,

    HD

    "atif" <-spam.invalid> wrote in message
    news:40039b8f$...
    > I hav a prob with the textfield i want to restrict this field so that
    > only integer values should b entered e.g 0-9 n no english or special
    > characters should b entered in the text field
    >
    >
    > Posted Via Usenet.com Premium Usenet Newsgroup Services
    > ----------------------------------------------------------
    > ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    > ----------------------------------------------------------
    > http://www.usenet.com
    Hermit Dave, Jan 13, 2004
    #2
    1. Advertising

  3. atif

    Dan Brussee Guest

    What I think you are asking for is a masked edit text box where it
    will only allow the digit characters to be entered. This action would
    be required on the client side - not on the server side, so ASP.NET is
    not involved. As stated in another response, you could do validation
    using regular expression, javascript, etc on the client or after it
    has been submitted on the server.

    However, there are cases where what you ask CAN be done on the client.
    It would require some fairly complex Javascript code and would very
    prone to failures on certain versions of browser. Although it seems
    reasonable to do, I say that it is easier all around - including for
    the user - if you just let them type what they want and validate it
    for correctness. Im sure you will need to validat anyway to be sure a
    value exists, etc. Remember, you are dealing with a very limited
    environment of a browser. I always hated masked input fields anyway,
    but that's just me :)

    Dan


    On 13 Jan 2004 01:17:35 -0600,
    -spam.invalid (atif) wrote:

    >I hav a prob with the textfield i want to restrict this field so that
    >only integer values should b entered e.g 0-9 n no english or special
    >characters should b entered in the text field
    >
    >
    > Posted Via Usenet.com Premium Usenet Newsgroup Services
    >----------------------------------------------------------
    > ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
    >----------------------------------------------------------
    > http://www.usenet.com
    Dan Brussee, Jan 13, 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. Prasad
    Replies:
    1
    Views:
    625
    Kelly Leahy
    Jan 16, 2004
  2. Paras Wadehra
    Replies:
    1
    Views:
    1,779
    =?Utf-8?B?U2F1cmFiaCBOYW5kdQ==?=
    Aug 15, 2004
  3. Lawrance
    Replies:
    1
    Views:
    367
    Bhaskardeep Khaund
    Nov 30, 2003
  4. Jaydeep
    Replies:
    3
    Views:
    1,046
    vedcyrus
    Jun 30, 2006
  5. Gaurav
    Replies:
    2
    Views:
    383
Loading...

Share This Page