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.

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.

Is it because you have the string in single quotes?

That's the way all the sample codes shows it should be.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.