Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Validation spanning a group of text boxes

I'm trying to achieve the following: enter image description here

Where:

  • Surname is always required
  • NI Number OR Reference Number is required

Is this beyond the scope of the ASP.NET Validation Controls? The only solution I can think of is writing some bespoke javascript (for client side) and backing that up with some server side code.

like image 463
m.edmondson Avatar asked Feb 01 '26 07:02

m.edmondson


1 Answers

One thing you can try is to have a CustomValidator(see here) check that both textboxes are not empty. Then validate both textboxes with a regular expression. The expression should check for either a valid entry OR a blank field.

like image 101
Edwin de Koning Avatar answered Feb 03 '26 19:02

Edwin de Koning