I’m trying to require the user to enter data in at least one of five textboxes before running a search query. .
I’m getting error messages about
-
converting a string to boolean
2 “Operator ‘&&’ cannot be applied to operands of type ‘string’ and ‘string'”if (txtLoginName.Text=String.Empty && txtDisplayName.Text = String.Empty && txtCode.Text = String.Empty && txtEmailAddress.Text = String.Empty && txtName.Text = String.Empty) { lblErrorMessage.Text = "At least one search criteria is required."; return; }
Try the code below. In your sample you were using “=” instead of “==” in C#.
Another way to accomplish the same thing would be to use this: