sort gridview with dynamic linq
<p>I have a gridview with several columns, 3 of which I'd like to sort.
The source for the data is held in the session.</p>

<pre><code>protected void MyGridHistorySort(object sender, GridViewSortEventArgs e)
{
    var TheColumn = (e.SortExpression).ToString();

    TheDataHistory = (List&lt;ViewDataHistoryModel&gt;)Session["SessionDataHistory"];

    var test = "data.DataDate";

    var NewDataSource = from data in TheDataHistory
                    orderby test
                    select data;

    MyGridHistory.DataSource = NewDataSource;
    MyGridHistory.DataBind();
</code></pre>

<p>DataDate is a valid column in the list but the orderby statement doesn't work. Ideally, I'd like it to sort with the variable TheColumn by writing something like test = "data."+TheColum; and then add a sort direction based on a boolean. I looked at the OrderBy extension method NewDataSource.OrderBy(test); but that doesn't work either.</p>

<p>What am I missing to make my code work?</p>

<p>Thanks.</p>
