GridView and SortExpression after Column Removed

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top