Tvd
Tvd

Reputation: 4601

Compare multiple textbox - Make sure 1 is entered

In my Content page I have 4 different TextBox's which is used to enter phone number - Mobile, Office Phone, Office Mobile & Other. I have RegularExpressionValidator for each.

I want to make sure atleast one of the above 4 textbox's has entered a value. I didn't find any example or article on net showing this situation. One way I think is in Submit button click, before Page.IsValid call, call a function that checks that one of the control has valid value. If the function returns false, show MessageBox. Is their any other way using Validators or so to comfirm that one textbox out of 4 has a valid value.

What can be the best way to achieve this ?

Any help is highly appreciated.

Thankss

Upvotes: 0

Views: 32

Answers (1)

Abdul Rehman Sayed
Abdul Rehman Sayed

Reputation: 6672

You can create a Custom Validator in ASP.NET.

This post should help you out.

asp.net required field validator for at least one textbox contains text

Upvotes: 1

Related Questions