CustomValidator.ClientValidationFunction not virtual

O

Oleg Ogurok

Hi all,

I'm wondering if there was any particular reason why Microsoft didn't make
this property overridable?
I'm building a custom validator by extending the existing CustomValidator
class, and it would be nice to hardcode the name of the client-side function
since it will never change. Otherwise I have to specify
ClientValidationFunction property everywhere in ASPX pages.

Is there a better approach?

Thanks.
-Oleg.
 
P

Peter Blum

I've found many non-virtual properties that I wish Microsoft made virtual.

I have two recommendations:
1. Your constructor can set the ClientValidationFunction property to its
fixed value.
2. If you are creating an actual validator class, Microsoft provides the
BaseValidator class for you to subclass, supplying the evaluation functions
for both client and server side, along with any properties you might like to
add. It may be a little more difficult but it lets you design as Microsoft
intended.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

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,007
Latest member
obedient dusk

Latest Threads

Top