Check required field in custom validator

Discussion in 'ASP .Net Web Controls' started by Alex Shirley, Jul 13, 2004.

  1. Alex Shirley

    Alex Shirley Guest

    Hi

    I'm trying to check for a required field in a textbox using a custom
    validator. I do not want to use a requiredfieldvalidator in this
    instance.

    I have tried the following code within the serverValidate handler and
    it will not work:

    If txtTheTextBox.Text.Trim <> "" Then
    args.IsValid = True
    else
    args.IsValid = False
    End If

    .... and it refuses to work! Note serverValidate code does fire (I am
    using other code as well in this custom validator and it works).
    I don't think the blank string comparison is working.
    Any ideas?

    Thanks

    Alex
     
    Alex Shirley, Jul 13, 2004
    #1
    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. Jinsong Liu

    Required Field Validator Client side popup

    Jinsong Liu, Aug 14, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    5,529
    Guenther Liebowitz
    Aug 14, 2003
  2. Do
    Replies:
    3
    Views:
    4,436
    Mike Moore [MSFT]
    Oct 23, 2003
  3. Jim Heavey

    Required Field Validator

    Jim Heavey, Nov 14, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    337
    Jim Heavey
    Nov 14, 2003
  4. Sogescom

    required field validator in Web custom control

    Sogescom, Jul 4, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    368
    Yan-Hong Huang[MSFT]
    Jul 8, 2003
  5. jr
    Replies:
    3
    Views:
    450
Loading...

Share This Page