"Cannot be validated" - why not???

O

Owen

Hi,

I have a custom control which comprises a label and a text input box. I add
one of these to my web form and call it "MyTextControl".

I am trying to havea RegularExpressionValidator which validates the text
input portion.

However, whenever I set the "ControlToValidate" property to "MyTextControl",
I get an exception.

Control 'MyTextControl' referenced by the ControlToValidate property of
'MyTextControlValidator' cannot be validated.


I just don't understand what the problem is. All the properties seem to be
correct, there are no typos or anything. But it doesn't like me setting the
ControlToValidate property to my custom control.

What am I missing? (examples in VB.net please)

Cheers
Owen

PS. replies cc'd via email appreciated.
(e-mail address removed)
 
S

S. Justin Gengo

Owen,

It's because the custom control doesn't have the same signature as a regular
text box (because it also contains a label). I think if you start off your
custom control as inheriting from text box so that all the text box hooks
exist (.NET will think it's just like any other text box) then your control
will work.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

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,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top