Question: Here we are again with the next problem in sorting.

this is a follow up question to [this question](https://stackoverflow.com/questions/975712/asp-net-gridview-sorting-with-linq-result)

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...

any ideas why this returns null ...

```
IEnumerable<JointServerData> data = gvServers.DataSource;
var sorted = data;
switch (p)
   {
       case "domain":
            sorted = data.OrderBy(o => o.DomainName);
            break;
       default:
            break;
    }
gvServers.DataSource = sorted;
gvServers.DataBind();

```

above is what I'm trying to do ...

Answer: 
I agree with Mark. It seems that this happens between postbacks. If so, you can't have access to grid's datasource, because after first binding and rendering this grid to html, you will receice only that html on postback, but not real datasource. You need to keep your datasource either in session or get it on every postback from database.

P.S. and sorry, guys, for my ugly English :-[
Try to set data binding in Init event of control.