title: Setting SqlDataSource Parameters from Request.Form
body: <p>I'm trying to create simple search. I have "txtSearch" textBox and "search" button in MasterPage, button has PostbackUrl= Search.aspx</p>
  
  <p>In MasterPage</p>
  
  <pre><code>&lt;asp:TextBox ID="txtSearch" runat="server" ValidationGroup="b" Text="Users Search" ForeColor="Silver"&gt;Users Search&lt;/asp:TextBox&gt;
  
  &lt;asp:Button ID="btnSearch" runat="server" Text="Search" ValidationGroup="b" 
  PostBackUrl="~/Search.aspx" onclick="btnSearch_Click" /&gt;
  </code></pre>
  
  <p>In Search.aspx i have GridView that shows me results and SqlDataSource</p>
  
  <pre><code>&lt;asp:SqlDataSource ID="SqlDataSearchResult" runat="server" 
      ConnectionString="&lt;%$ ConnectionStrings:ConnectionString %&gt;" 
  
      SelectCommand="SELECT vw_aspnet_Users.UserId, vw_aspnet_Users.UserName, Custon_UserInfo.UserId AS Expr1, Custon_UserInfo.FirstName, Custon_UserInfo.LastName, Custon_UserInfo.Location, Custon_UserInfo.Avatar, Custon_MoneyWork.UserId AS Expr2, Custon_MoneyWork.Money, vw_aspnet_Users.LastActivityDate FROM vw_aspnet_Users INNER JOIN Custon_UserInfo ON vw_aspnet_Users.UserId = Custon_UserInfo.UserId INNER JOIN Custon_MoneyWork ON vw_aspnet_Users.UserId = Custon_MoneyWork.UserId WHERE (vw_aspnet_Users.UserName LIKE '%' + @UserName + '%')"&gt;
      &lt;SelectParameters&gt;
          &lt;asp:FormParameter FormField="txtSearch" Name="UserName" Type="String" /&gt;
      &lt;/SelectParameters&gt;
  &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>In Define Parameters :
  UserName =Request.Form("txtSearch") as it needs to be, but it's not working. I tried with session["search"]=txtSearch.text; and its working.. But not with Request.Form..</p>
  
  <p><strong>UPD</strong>
  I tryed to use QueryStringField instead of FormField and it works, don't know whats wrong with FormField.</p>