validating server controls

Discussion in 'ASP .Net' started by Mike P, Nov 18, 2003.

  1. Mike P

    Mike P Guest

    I need to do custom validation on a set of server controls (text boxes,
    check boxes etc), but I don't have any control where it is required that
    the user enters a value.

    Since the ControlToValidate in the Custom Validator requires a refernce
    to a control that cannot be empty, how do I do my custom validation?


    Any help would be much appreciated.


    Cheers,

    Mike




    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mike P, Nov 18, 2003
    #1
    1. Advertising

  2. Mike P

    AW Guest

    You don't need to put anything in the "ControlToValidate" property of a
    CustomValidator, unlike the other validators.

    So jsut write something like that:
    private void CustomValidator1_ServerValidate(object source,
    System.Web.UI.WebControls.ServerValidateEventArgs args)

    {

    args.IsValid = CheckBox1.Checked;

    }

    Cheers,
    Arnaud
    --
    To reply, remove a "l" before the @ sign.

    Arnaud Weil - MCT, MCSD.Net, MCAD.Net
     
    AW, Nov 18, 2003
    #2
    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. RA
    Replies:
    2
    Views:
    309
    Alvin Bruney
    Nov 23, 2003
  2. Paul
    Replies:
    1
    Views:
    355
    Peter Blum
    Nov 29, 2003
  3. Darrel
    Replies:
    3
    Views:
    422
    Darrel
    Nov 15, 2004
  4. nicholas

    validating groups of user controls

    nicholas, Apr 7, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    399
    nicholas
    Apr 8, 2005
  5. Replies:
    4
    Views:
    869
    GreggTB
    May 22, 2005
Loading...

Share This Page