CustomValidator and shared function

R

Robert Scheer

Hi.

I created a new class where I defined some shared methods. One of
these methods (called IsInvalidKey) is a generic function that I wants
to use with several customvalidator controls.

In my .aspx page I defined an imports for my shared class:
<%@ Import namespace="Webfinder.Helper" %>

And for my customvalidator control I have:
<ASP:CUSTOMVALIDATOR id="custKey" runat="server"
controltovalidate="txtKey" clientvalidationfunction="IsKey"
onservervalidate="Validations.IsInvalidKey">*</ASP:CUSTOMVALIDATOR>

When I run the page I get the error:
BC30456: 'Validations' is not a member of 'ASP.FindUser_aspx'

If I define the function directly at the page's code-behind, it all
works.

How can I define a server-side function to use with several
customvalidators?

Thanks,
Robert Scheer
 
S

Scott Allen

Hi Robert:

You'll have to define a method in your page that forwards (invokes) the shared
method of the other class. Make sense?
 

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,774
Messages
2,569,600
Members
45,180
Latest member
CryptoTax Software
Top