Typo - make one of the lines:
args.IsValid = (!String.IsNullOrEmpty(txt
Main Topics
Browse All TopicsASP.NET VB.NET. .NET 2.0 Validation
How can I accomplish the following validation task:
I have two fields - and the user must enter a value in at least one of them. So simply using a required field validator on each won't work because they both are not required, only one of them is. So how can I (using client-side) accomplish this ?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
No, you need serverside. Clientside would only be an advantage as it saves you the roundtrip, not the validity of the data.
Using javascript it would be like:
function isValid(){
var txtBox1 = document.getElementById("t
var txtBox2 = document.getElementById("t
return (txtBox1.value!=""||txtBox
}
Make sure you call this clientside method when the button is clicked or form is submitted.
btnMySubmitButton.Attribut
Cheers,
CJ.
Business Accounts
Answer for Membership
by: CJ_SPosted on 2007-06-06 at 09:34:59ID: 19226502
Multiple options available, simplest would be:
+= new ServerValidateEventHandler (valOneOfT wo_ServerV alidate);
(object source, ServerValidateEventArgs args) x1.Text) && !String.IsNullOrEmpty(txtB ox2.Text);
<asp:customvalidator id="valOneOfTwo" runat="server" ... />
...
protected override void OnInit(EventArgs e)
{
...
valOneOfTwo.ServerValidate
base.OnInit(e);
}
void valOneOfTwo_ServerValidate
{
args.IsValid = String.IsNullOrEmpty(txtBo
}