title: Change select command of sqldatasource at runtime
body: <p>HTML</p>
  
  <pre><code> &lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1"&gt;
     &lt;Columns&gt;
         &lt;asp:BoundField DataField="id" HeaderText="id"  /&gt;
         &lt;asp:BoundField DataField="name" HeaderText="name" /&gt;
     &lt;/Columns&gt;
   &lt;/asp:GridView&gt;
  
  &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:database1ConnectionString %&gt;"
  SelectCommand="SELECT * from tblCourse"&gt;&lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>Code</p>
  
  <pre><code> SqlDataSource1.SelectCommand =
          "SELECT  * from tblCourse where name='"+textbox1.text+"'";
    SqlDataSource1.DataBind();
  </code></pre>
  
  <p>But Gridview does not change based on the new select command, even when I'm using DataBind()</p>
  
  <p>How can we change grid view base on select command of sql data source?</p>