CustomValidator Question

  • Thread starter Thread starter David Marr
  • Start date Start date
D

David Marr

Hello,
I am trying to use a custom validator on three fields. The user has two
options:

1. Fill in two textboxes (first name and last name)
or
2. Select an existing name from a drop down.

I am trying to make either path they choose to be required. I have the
following code but the logic seems flawed somewhere. Am I going about this
correctly?

My code:

http://authors.aspalliance.com/aylar/ViewPasteCode.aspx?PasteCodeID=3340

Thanks for any help,
Dave
 
David, as you're finding out, custom validators really aren't well
designed for validating more than one field. With ASP.NET 1.x,
validators are designed to validate a specific form field.

If this is for a professional project, you might want to consider
picking up a copy of Peter Blum's Validation And More controls -
http://peterblum.com/VAM/Home.aspx. These controls from Peter allow for
a number of advanced validation scenarios, including "The ability to
combine the rules of several validators under one error message using
the MultiConditionValidator" - see
http://peterblum.com/VAM/RulesToEval.aspx?ReturnUrl=Home.aspx#Multi

hth


David said:
I am trying to use a custom validator on three fields. The user has two
options:

1. Fill in two textboxes (first name and last name)
or
2. Select an existing name from a drop down.

I am trying to make either path they choose to be required. I have the
following code but the logic seems flawed somewhere. Am I going about this
correctly?

My code:

http://authors.aspalliance.com/aylar/ViewPasteCode.aspx?PasteCodeID=3340


--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 
Thanks Scott,
Is there any other way to get around purchasing those components? I feel
like this must be a somewhat frequent request, but I could be wrong.

Thanks,
Dave
 
Back
Top