Validator for server control inside user control

S

superman

Hello,

I am facing a strange situation and have already spent a lot of time on
this. I have a user control 'U' that consists of a server/composite control
'C'. C consists of a textbox 'T' and a datepicker 'D' and implements
INamingContainer. The user-selected date from D appears in T. The
validationproperty of C is set to the 'Text' property of T. 'U' also consists
of a RequiredFieldValidator 'R' that validates C (i.e. The text property of
T).

When I use 'U' in an .aspx page, the id of the rendered textbox becomes U:C.
However, the validator R's ControlToValidate property is set to U_C. Thus,
the validation never fires since it is referencing to UniqueID instead of the
ClientID of C.

What am I missing? Any help is appreciated.

Thanks,
superman
 
B

Brennan Stehling

I would first check the ValidationGroup on every control involved.
Then run through this with the debugger. What you may have to do is
use a custom validator which manually checks the value in question.

Brennan Stehling
Microsoft Notepad MVP :)
http://brennan.offwhite.net/blog/
 
S

superman

Brennan,

I forgot to mention that I am working with .NET framework v1.1 and not 2.0.
I don't see any validation group property.
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top