Custom validator on multiple fields?

T

Tarun Mistry

Hi everyone, is it possible to make a custom validator work on multiple
fields?

I have 3 input text boxes, I would like a validator that checks to ensure at
least 1 of them contains informaion before allowing the form to be
submitted.

Any help apprecated,

Kind regards
Taz
 
T

Teemu Keiski

Hi,

you can use CustomValidator so that don't specify the ControlToValidate at
all. In that case, you'd sort of hard-code in the validation logic which
controls you check for with it. That way you can check multiple of them.

I've also developed (though a long time ago, so the quality of code is what
it is) such validator which can take the controls to be validated as
comma-separated string
http://authors.aspalliance.com/joteke/validationarticle1/article.aspx
 
T

Tarun Mistry

Many thanks Teemu, this is exactly what I needed.

Appreciate your help.

Regards
Taz
 
Joined
Mar 24, 2008
Messages
2
Reaction score
0
Hi Teemu, I added the code above to my vb.net project. I need to make user the user enters at least one of 3 textfield values. However, I'm getting the following two errors: Error1 Element 'EmptyControlCompareValidator' is not a known element. This can occur if there is a compilation error in the Web site. Error2 Unknown server tag 'asp:EmptyControlCompareValidator'. Any help would be appreciated. Thanks! Sofia :)
 
Joined
Mar 24, 2008
Messages
2
Reaction score
0
Hi, I added the code above to my vb.net project. I need to make user the user enters at least one of 3 textfield values. However, I'm getting the following two errors: Error1 Element 'EmptyControlCompareValidator' is not a known element. This can occur if there is a compilation error in the Web site. Error2 Unknown server tag 'asp:EmptyControlCompareValidator'.

I added the following code as well on the top of my source code:

<%@ Register Assembly="EmptyControlCompareValidator" Namespace="MansoftValidators" TagPrefix="cc1" %>

Any help would be appreciated. Thanks! Sofia
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top