Dan
Dan

Reputation: 4663

How do I sort a bound column by default in a DataGrid?

I have a DataGrid and I want to specify that a column is sorted by default. Using the SQL sort is not working as intended, but when I click the column header it sorts exactly as intended. I just want it to do this by default.

Upvotes: 0

Views: 203

Answers (1)

suff trek
suff trek

Reputation: 39767

Assuming you're talking about GridView you can use GridView.Sort method to sort the grid programmaticaly. E.g.

MyGrid.Sort("MyColumn", SortDirection.Ascending)

Upvotes: 1

Related Questions