Custom Composite Web Control and Validator

Discussion in 'ASP .Net Building Controls' started by Rick, Jun 2, 2007.

  1. Rick

    Rick Guest

    Hello,

    I built a composite web control that has a textbox and a date
    control.
    added my custom control on a webform where there are other standard
    controls.
    Each control on the form has a required validator.
    I need to have a validator for my custom control, but don't know how
    to do this.
    I added a CustomValidator to the form, but in design mode, my custom
    control doesn't appear in the list of controls of the validator.
    Any help to work around this will be greatly appreciated.

    Thanks,

    Rick
     
    Rick, Jun 2, 2007
    #1
    1. Advertisements

  2. Rick

    Riki Guest

    For a CustomValidator, there's no need to indicate a ControlToValidate.
    Just leave it blank.
    It's your custom validation code that will decide which values it's going to
    check.
     
    Riki, Jun 4, 2007
    #2
    1. Advertisements

  3. Rick

    Rick Guest

    Hi Riki,

    Thanks. I did as you said, and set the args.IsValid accordingly in the
    custom validator's event handling sub, but I must be missing something
    b/c the event for the custom validator isn't getting fired. I have a
    breakpoint in this event and it isn't stopping there. I'm new to aspx
    and I'd appreciate any help to make this user control work with the
    validator.

    Thank you in advance,

    Rick
     
    Rick, Jun 11, 2007
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.