how to populate a gridview based on a session
<p>I created an empty gridview, and i created an sqldatasource, the select statement is this</p>

<pre><code>SELECT S.[ID], S.[Survey_Name], S.[Start_Date], S.[End_Date], C.[Category_Name], S.[Username], S.[Audience] FROM [Survey] S
Inner Join
Category C On S.Category_ID = C.ID Where Username = @Username
</code></pre>

<p>after that I pick the parameter's source as "Session" and its Session Field as "Username", this session is populated at login time. when i test it, and enter a username it works, but when running the program the gridview is always blank.</p>

<p>EDIT: My aspx.page code.</p>

<pre><code>&lt;asp:SqlDataSource 
    ID="SqlDataSource1"
    Runat="server" 
    SelectCommand="SELECT S.[ID], S.[Survey_Name], S.[Start_Date], 
                 S.[End_Date], C.[Category_Name], S.[Username], S.[Audience] 
                 FROM [Survey] S Inner Join Category C 
                      On S.Category_ID = C.ID Where Username = @Username"
    SelectCommandType="Text"
    ConnectionString="&lt;%$ ConnectionStrings:SurveySystemConnectionString %&gt;"&gt;
    &lt;SelectParameters&gt;
       &lt;asp:SessionParameter Name="Username" DbType="String" 
            DefaultValue=""  SessionField="username"/&gt;

    &lt;/SelectParameters&gt;
&lt;/asp:SqlDataSource&gt;
</code></pre>

<p>EDIT: My login button</p>

<pre><code>protected void LoginButton_Click(object sender, EventArgs e)
        {
            lblerror.Visible = false;

            SqlConnection conn = DatabaseConnection.GetSurveySystemConnection();             
            string queryString = "SELECT * FROM [Users] WHERE Username=@username AND Password= @password";
            SqlCommand command = new SqlCommand(queryString, conn);
            command.Parameters.AddWithValue("@username", UserNameTextBox.Text);
            command.Parameters.AddWithValue("@password", PasswordTextBox.Text);

            SqlDataReader reader = null;
            reader = command.ExecuteReader();

            if (reader.Read())
            {
                Session["Username"] = UserNameTextBox.Text;
                Session["Name"] = (string)reader["name"];
                Session["UserType"] = (string)reader["UserType"];
                Response.Redirect("Home.aspx");
            }
Connection.close();
}
</code></pre>
