title: Sort a GridView thats bound to a Linq query
body: <p>I've got a GridView that I populate using a Linq query</p>
  
  <pre><code>var usersToApprove = from rl in QVDash.Permisisons
                             join u in QVDash.Userson rl.UserId equals u.UserId
                             join d in QVDash.Dashboards on rl.DashboardId equals d.DashboardId 
                             where (u.ApprovedBy == approverId || isGod)
                             select new
                             {
                                 PermissionId = rl.PermissionId,
                                 Name = u.Name,
                                 Area = u.Area,
                                 Dashboard = d.DashboardName,
                                 OpUnit = rl.Operational_Unit,
                                 Cost_Centre = rl.Cost_Centre,
                                 Fund = rl.Fund,
                                 Project = rl.Project,
                                 Approver = (from a in QVDash.Users where a.UserId == u.UserId &amp;&amp; a.UserId == u.ApprovedBy select a.Name).FirstOrDefault()
                             };
  
          grd_CurrentUsers.DataSource = usersToApprove ;
          grd_CurrentUsers.DataKeyNames = new string[] { "PermissionId" };
          grd_CurrentUsers.DataBind();
  </code></pre>
  
  <p>This however presents an issue, where the GridView will not allow sorting.  </p>
  
  <p>I've tried a few options that I've found which resort to building a custom sorting function, however I've found this to be sketchy at best, which issues such as: Only one way sorting, Paging resets sort etc.</p>
  
  <p>What I'm wanting to know is if there is a better way to do this.</p>
  
  <p>I know that binding the gridview to a datasource takes care of the sorting issue, however I don't know how to bind my Linq to a data source.  Is it possible?</p>