I sort one column. Then edit one value in that column - the row automatically repositions itself.
If I disable sorting on that column (or even the whole grid) before edit and turn it back on when value is changed in CellValueChanged event, it sorts again.
How can I make the grid sort only when I click on a column header?
edit:
I accepted the suggestion below as the answer as I was looking in the same direction, but to make it clearer for somebody that might stumble upon this, here's my implementation in VB.net. Grid has to have EnableCustomSorting = True.
Private Sub grid_CellClick(sender As Object, e As GridViewCellEventArgs) Handles grid.CellClick
If TypeOf sender Is GridHeaderCellElement Then
If dtGrid.DefaultView.Sort = e.Column.Name + " ASC" Then
dtGrid.DefaultView.Sort = e.Column.Name + " DESC"
'This line displays "down arrow" in column header, but makes sorting much slower for some reason.
'e.Column.SortOrder = RadSortOrder.Descending
Else
dtGrid.DefaultView.Sort = e.Column.Name + " ASC"
'e.Column.SortOrder = RadSortOrder.Ascending
End If
End If
End Sub
If you want an one-shot sort, you should reorder your object in your datasource (move the object in your list or create a new one by adding the item in the new order then rebound).
Then, of course, you have to handle this with the click event on the column header.