By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,040 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

"Cannot be validated" - why not???

P: n/a
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.
ow************@mantix.com
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
"Owen" <sp**@spam.com> wrote in message
news:rW****************@newsfe7-gui.ntli.net...
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.
ow************@mantix.com

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.