Ivalidator and Validation Groups

B

brantman

Here is a question that needs to be revisited. I noticed that there are
more that a few posts about this in this group and in custom controls.
Here is the problem:
When inheriting from a webcontrol, say textbox for example, and
implementing the IValidator interface to make the control
self-validating, the control fails to participate in validation groups.
Using reflector, it is easy to see why; the page.validator casts all
the controls in the collection to BaseValidator, thus a control derived
from a TextBox implementing IValidator gets cast to Nothing (Null).
However all the correct attributes and abilities are there. So the
question that still remains unanswered by all the .NET gurus in this
group is-- How can a control created as aformentioned be forced to
participate in the validation groups of ASP.Net 2.0?

Some thoughts of mine are: Cast the control myself using a custom type
caster?? Is this possible?
Perhaps I could create a basevalidator object in my control and using
delegates have it still fire my Validate() function of my control and
modify the isValid property and display the message i have set up.
This seems very complicated and riddled with opportunities for even
greater obsticals that the one I am trying to overcome.
Use a composit control that includes a custom validator derived from
BaseValidator. This is the most strait foward for the validation
groups, but complicates the rest of the control.
To see the code used for my Textbox self validating control, look at my
forums http://forums.atechinnovations.com/viewtopic.php?t=22
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top