I have an ASP.NET gridview where I allow the user to edit a record. I need to validate multiple fields as one. I need to require that the user either enter a first and last name OR a company name. All three cannot be blank.

Most of the sample code I am finding does not address the text boxes only being visible while the gridview is in edit mode. When not in edit mode, the text boxes do not exist so

document.getElementById('<%= editFirstName.ClientID %>')

throws an error upon page load.

7 Years
Discussion Span
Last Post by SBA-CDeCinko

Welcome to the forums, please take your time and introduce yourself in http://www.daniweb.com/forums/forum165.html

Hmm Not sure what you are doing.

Are you saying you want to check which text box is filled or are you saying all three textboxes have to be filled?

Why are you calling that on page load, it should be empty on Page load.


I need to make sure at least one of the three text boxes is filled. I'm not calling it at page load, the page refuses to compile when attempting to load. I have a solution figured out for the server side. I just can't get the client side javascript to work.

The line referenced above is failing. I am unable to get a reference to the text box.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.