title: ASP.net gridview datasource null when sorting
body: <p>Here we are again with the next problem in sorting.</p>
  
  <p>this is a follow up question to <a href="https://stackoverflow.com/questions/975712/asp-net-gridview-sorting-with-linq-result">this question</a></p>
  
  <p>I have now made a type to contain the data I need.
  however, when I try to fetch the data FROM the gridview it returns null, which means I can't sort anything that is not there in the first place...</p>
  
  <p>any ideas why this returns null ...</p>
  
  <pre><code>IEnumerable&lt;JointServerData&gt; data = gvServers.DataSource;
  var sorted = data;
  switch (p)
     {
         case "domain":
              sorted = data.OrderBy(o =&gt; o.DomainName);
              break;
         default:
              break;
      }
  gvServers.DataSource = sorted;
  gvServers.DataBind();
  </code></pre>
  
  <p>above is what I'm trying to do ...</p>