Something has changed in the latest version (2011.2.920.1040) of the GridView in handling programatic sorting. Let me start with the white screen exception then explain how we add the sort descriptor:
Our system is set up to at times override the default sorting set up a domain data source if the user so chose to. On a first load, say we sort by a column called 'code.' During the use of the page, the user can choose to resort the grid with a different column. When they leave the page, during the unloaded event we then capture which sort they put into place and store it in app resources. If they navigate back to the page, we then restore those custom sort descriptors programatically. Here is where that issue above comes into place.
The code to restore the setting (after retreiving it from app resources) - I've set this code up with hard coded strings to explain the example after:
Domain data source is set up for AutoLoad to false and after the code runs above, it is programatically changed to true but after the code above has completed.
Because we are using a Domain Data Source (DDS), we found that the sort must be set up on the DDS first then the grid. At times, however, that sort path may be different for each; specifically when trying to sort via a projected property (i.e. a property from a reference property of the entity being bound). If Entity A has a relationship to Entity B, Entity Framework obviously sets up a property on Entity A called 'Entity B.' Using include statements, we set up a projected property for Entity B's Description field called "EntityBDescription" which will include this property directly to Entity A for display. The problem is the actual sort path would be "EntityB.Description" for the DDS but "EntityBDescription" for the grid. This approach worked perfectly on the GridView until now.
On the return visit, the restore code above produces the exception that I listed and I'm unsure as to why.