How do I sort a DataTable on the client side using LINQ? (Server side sorting is not supported with my data store)
I was doing something like this which doesn't work
IEnumerable<DataRow> dr = GetDataTableData().AsEnumerable();
if (sortDirection == "Ascending")
{
dr = dr.OrderBy(x => sortExpression);
}
else
{
dr = dr.OrderByDescending(x => sortExpression);
}
GridView1.DataSource = dr;
GridView1.DataBind();
But I dont see the gridview sorting at all, what am I missing here?