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. Advertising

  2. Rick

    Riki Guest

    Rick wrote:
    > 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.


    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
    Riki, Jun 4, 2007
    #2
    1. Advertising

  3. Rick

    Rick Guest

    On Jun 4, 8:31 am, "Riki" <> wrote:
    > Rick wrote:
    > > 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.

    >
    > 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


    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. 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. Replies:
    0
    Views:
    699
  2. Jonathan Eric Miller
    Replies:
    2
    Views:
    319
    Jonathan Eric Miller
    Jul 22, 2004
  3. Donal McWeeney

    custom validator and ControlToValidate in a composite control...

    Donal McWeeney, Sep 28, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    207
    Donal McWeeney
    Sep 29, 2004
  4. Chad
    Replies:
    0
    Views:
    207
  5. Rick

    Composite Custom Web Control and external Validator

    Rick, Jun 2, 2007, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    136
Loading...

Share This Page