//gridview and search protected void clientSearch_btn_Click(object sender, EventArgs e) { try { String whereclause = ""; if (firstName_txt.Text != "") { whereclause += "AND f_name LIKE '%" + firstName_txt.Text.Replace("'", "''") + "%'"; } else if (lastName_txt.Text != "") { whereclause += "AND l_name LIKE '%" + lastName_txt.Text.Replace("'", "''") + "%'"; } else if (dateOfBirth_txt.Text != "") { whereclause += "AND birthdate = '" + dateOfBirth_txt.Text.Replace("'", "''") + "'"; } else if (address_txt.Text != "") { whereclause += "AND str_add LIKE '%" + address_txt.Text.Replace("'", "''") + "%'"; } else { lbl_Client_Error.Text = "At least one text box needs to be filled to search."; } gvClientSearchresult.DataSource = client.Search_Client(whereclause); gvClientSearchresult.DataBind(); } catch (Exception ex) { lbl_Client_Error.Text = "Error looking for Client"; } }