title: Using A Session Variable In ASP.Net Gridview
body: <p>I have a session variable which holds the current logged in user's details. I'd like to run a query based on the variable and display it in a <strong>Grid view</strong>.
  I want to replace the default value of the grid view with the session variable but that didn't work. </p>
  
  <p>Can anyone point me in the right direction?</p>
  
  <p><strong>This is what I tried:</strong></p>
  
  <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
      ConnectionString="&lt;%$ ConnectionStrings:..... %&gt;" 
  
      SelectCommand="SELECT [Username], [Password], [CustomerName], [CustomerAddress], [Contact] FROM [Customers] WHERE ([Username] = @Username)"&gt;
      &lt;SelectParameters&gt;
          &lt;asp:Parameter DefaultValue="session[new]" Name="Username" Type="String" /&gt;
      &lt;/SelectParameters&gt;
  &lt;/asp:SqlDataSource&gt;
  </code></pre>