Validation inside composite controls for ASP .NET 2.0

J

JorgeDorcasGarcia

I'm creating a group of composite controls. Some are more granular than
others, for example, a Zip Code control. The control has a TextBox for
Zip Code, a TextBox for Zip Extension and compare validators for both
of these controls in order to make sure the user enters numeric
information.
If I put this composite control in my page by itself, the client side
validation works perfectly fine, but as soon as I wish to use this
control inside another composite control, like say, an "Address"
control, the client side validation starts to generate javascript
errors at load time, apparently not able to find the controls on the
page, when the page loads in the browser. I am stating inside the Zip
Code composite control that the cvZipCode.ControlToValidate =
txtZipCode.ID. Note, I'm NOT getting a server side error, the error is
on the client side scripting. Is this a bug in the framework? Does this
mean I won't be able to use validation if I go 2 levels deep in my
composite controls? I even tried with one of the MSPress controls
(datepicker) from the book "ASP.NET SERVER CONTROLS AND COMPONENTS" and
it also gives me errors with it.

Any help would be appreciated greatly.

Thanks.

Jorge L. Garcia
Miami, FL
 
B

Brock Allen

Does your composite control derice from CompositeControl or does it implement
INamingContaner?
 
J

JGarcia

It derives from CompositeControl, which as far as I know, it implements
the INamingContainer interface.
 
B

Brock Allen

Yeah, CompositeControl implements it. I was hoping this would be the problem
and thus the quick fix for you. I'll have to go think about it some more
then :)
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top