title: searching data in Gridview c# asp.net
body: <p>I am new to c# asp.net. How to search data in a Gridview? My Gridview on page load has all the records from the database. I've been searching on it, most is just searching with an empty GridView. So yeah, mine is not empty.
  ERROR: Both DataSource and DataSourceID are defined on 'GridView1'.  Remove one definition.</p>
  
  <pre><code>        String str = "select * from tblEmployee where (Name like '%' + @search + '%')";
          SqlCommand xp = new SqlCommand(str, objsqlconn);
          xp.Parameters.Add("@search", SqlDbType.NVarChar).Value = TextBox1.Text;
          objsqlconn.Open();
          xp.ExecuteNonQuery();
          SqlDataAdapter da = new SqlDataAdapter();
          da.SelectCommand = xp;
          DataSet ds = new DataSet();
          da.Fill(ds, "Name");
          GridView1.DataSource = ds;
          GridView1.DataBind();
          objsqlconn.Close();
  </code></pre>