Lynn Emery

Lynn Emery

  • NA
  • 47
  • 40k

Hide or show label based on seach.

Apr 25 2013 7:58 AM
Hi, on my asp.net page I have a search box, a label and a database connection.

I am trying to show or hide the label depending on the data inputted into the search box.
For example if a user enters ID number 3452 into the search box and it is not in the database the label should be visible, however if it is a valid ID within the database the label should be hidden.

I have the following code in my system however the label is showing even if the ID entered is in the database is valid.

if (TextBox50.Text != "CCARNo")
        {
            Label5.Visible = true;
        }
        else
        {
            Label5.Visible = false;
        }
Does anyone know what I must do to get the code working as expected?
Thank you for your help.

Answers (1)