GridView and SortExpression after Column Removed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top