Results 1 to 3 of 3

Thread: [02/03] use Validator Control in asp.net

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Question [02/03] use Validator Control in asp.net

    I have a textbox(this textbox is required and must be numeric). I want to use regular expression validator to validate it.
    I set ValidationExpression="\d{1,10}", but it allow blank field(not allow numeric). How can I don if i want a textbox(required and must be numeric)? I do not want to use two validator controls

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [02/03] use Validator Control in asp.net

    Why not use two? You can set their positions to be dynamic so that they appear to be just one * in place when the user hasn't filled the value in.

  3. #3
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: [02/03] use Validator Control in asp.net

    Both regular expression validators and range validators succeed if a textbox is empty so as far as I'm aware you will have to also use a requiredFieldValidator.

    I do this and do not have a problem with it.

    If you're really against using 2 validators you could make your own control such as a requiredRegularExpressionValidator.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width