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

CustomValidator and shared function

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


P: n/a
Hi Robert:

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

--
Scott
http://www.OdeToCode.com/blogs/scott/
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

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.