Results 1 to 9 of 9

Thread: [RESOLVED] I want TextBox not to call the validation function when it loses the focus

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    Resolved [RESOLVED] I want TextBox not to call the validation function when it loses the focus

    Hi,
    I have textbox and customvalidator, when the textbox loses the focus, the clientvalidationFunction and myCustomValidator_ServerValidate are called and the error message is displayed if the validation fails, what if I want the server and client validation functions to be called and validation error message displayed only when I click a certain button on the page and not when the textBox loses focus?

    Thank you.
    Thanks a lot for your help.

  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: I want TextBox not to call the validation function when it loses the focus

    Set the textbox's CausesValidation property to false. Not sure if that's the right answer but try it.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    Re: I want TextBox not to call the validation function when it loses the focus

    I tried it, no luck either mister Mendhak.
    Thanks a lot for your help.

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: I want TextBox not to call the validation function when it loses the focus

    Don't set the ControlToValidate property. On a PostBack the ServerValidate event(s) will still fire, giving you a chance to validate the entire page...

    Not sure about the Client validation however...

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    Re: I want TextBox not to call the validation function when it loses the focus

    thanks a lot, it works like a charm
    Thanks a lot for your help.

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

    Re: [RESOLVED] I want TextBox not to call the validation function when it loses the focus

    It's odd that's worked for you, validators usually complain if you don't give it a ControlToValidate value.

  7. #7
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: [RESOLVED] I want TextBox not to call the validation function when it loses the focus

    Except the CustomValidator control. It is the only validator whose ControlToValidate property can be empty.

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

    Re: [RESOLVED] I want TextBox not to call the validation function when it loses the f

    Bruce learns something new every day.

  9. #9
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: [RESOLVED] I want TextBox not to call the validation function when it loses the focus

    Amazing what you can learn when you RTFM.

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