title: How to pass a search text with more than one search condition to bind gridview according to it?
body: <p>I am trying to pass searching text and based on the text entered into the textbox I want to fetch data from the database and display into gridview.
  I have a gridview which consists of Country name, Company Name, Product Category. Currently I am using a Textbox in which I am entering Company name and Holding this data into a session variable and passing this session variable as a where clause with the select query to display into gridview. I want that If I enter Country name and Product name in the same textbox then also the gridview data should display. How can I do this by using a single textbox?
  My aspx page-</p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;asp:TextBox ID="TextBox1" runat="server" Width="167px"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" 
          Width="116px" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;asp:GridView ID="GridView1" runat="server"&gt;
  &lt;/asp:GridView&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>My cs Page-</p>
  
  <pre><code>public void bind()
      {
              dt = g1.return_dt("select  * from tbl1 where id is  not null  " + Session["Name"] + "  order by  compname ");
              if (dt.Rows.Count &gt; 0)
              {
                  adsource = new PagedDataSource();
                  adsource.DataSource = dt.DefaultView;
                  adsource.PageSize = 10;
                  adsource.AllowPaging = true;
                  adsource.CurrentPageIndex = pos;
                  btnfirst.Enabled = !adsource.IsFirstPage;
                  btnprevious.Enabled = !adsource.IsFirstPage;
                  btnlast.Enabled = !adsource.IsLastPage;
                  btnnext.Enabled = !adsource.IsLastPage;
                  GridView1.DataSource = adsource;
                  GridView1.DataBind();
              }
              else
              {
                  GridView1.DataSource = null;
                  GridView1.DataBind();
              }
  
  }
  
  protected void Button1_Click(object sender, EventArgs e)
      {
  if (TextBox1.Text != "")
          {
              Session["Name"] = "and  compname  like '%" + TextBox1.Text + "%'";
          }
          else
          {
              Session["Name"] = null;
          }
  }
  </code></pre>
  
  <p>I want to know How can I use this Session["Name"] object to pass Product Category and Country Name along with the Company Name. i.e. I want to know How can I display data in my gridview based on the different condition passed from this textbox.
  Please guide me.</p>