tags:

views:

49

answers:

1

I have multiple textboxes which im using for search query ,i want to validate them in such a way that if any one text box has value user can submit.

Can anyone suggest me ,how to do it .

Thanks

A: 

On your click event for the submit button, include some if/then statements that check all of the textboxes to see if they have acceptable values. If you just want to be sure that at least one box has data entered in it, then you could do this:

if (textBox1.Text != "" || textBox2.Text != "" || ...)
{
    // process form submission
}
else
{
    // inform user of missing data
}

If you are doing this client-side, in the web application, your best method will be to use JavaScript to perform the validation when the submit button is clicked. Otherwise the user will have to wait for the server to check the variables and get a new page.

JYelton