How to validate that at least one text box has input

  • Thread starter Thread starter Homer
  • Start date Start date
H

Homer

Hi,

I've created a page that allows employee to change their personnel
information, like name, marital status, address, etc. When the user
clicks the Send button to send the change requests via email to HR, I
want to make sure that at least one of the text boxes has input. For
example, a user may only want HR to change his marital status and
nothing else. In this case, validation should pass and an email is
sent. However, if nothing is entered and the user clicks send, the
send operation should not be executed and the user should be alerted
that at least one change must be inputted before clicking send. I
cannot use a validator control before if one control does not have
input, the Page.IsValid would be set to False. Is there a way to do
this?

Thanks,
Jon
 
You can use a CustomValidator. The client and server side validation
functions should compare the new values with orignal value and set
args.IsValid to true is at least one value is changed.
 
Back
Top