Hello Try this, This will work 100%
protected void BtnSearch_Click(object sender, ImageClickEventArgs e)
{
SqlConnection con = new SqlConnection(_connString);
SqlCommand cmdSearch = new SqlCommand("Select cusName,cusCode from tblCustomer where cusName='" + TxtSearch.Text + "' or cusCode ='" + TxtSearch.Text + "' ", con);
SqlDataAdapter da = new SqlDataAdapter(cmdSearch);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count == 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "RunCode", "javascript:alert('Sorry No Records Found with this Keyword.....');document.location.href="/KB/answers/SamePage.aspx";", true);
}
else
{
GridViewTesting.DataSource = dt;
GridViewTesting.DataBind();
}
}