[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Custom Composite Web Control and Validator

Rick

6/2/2007 5:08:00 AM

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

2 Answers

Riki

6/4/2007 12:32:00 PM

0

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


Rick

6/11/2007 2:10:00 PM

0

On Jun 4, 8:31 am, "Riki" <r...@dontnagme.com> 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