You can use the GridView.Sort method to set the sort order to a default
expression after you hide a column
http://msdn2.microsoft.com/en-us/lib...rt(VS.80).aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"James Rosewell" wrote:
> I'm getting an error in the following scenario.
>
> - A GridView control is bound to an SQLDataSource.
> - The user selects a column for sorting.
> - Some time later in code the column used for sorting is removed and the
> SelectCommand SQL changed so that the field is not returned.
> - When the GridView is redisplayed an error occurs because the
> GridView.SortExpression is no longer a valid column.
>
> The SortExpression property of the GridView control is read only so it can't
> be set to null or changed.
>
> My question is how can I implement this behaviour without the error occuring?
>
> James