You can implement ASPxGridView sorting using custom rules, it is necessary to set the column's Settings.SortMode property to "Custom" and handle the ASPxGridView.CustomColumnSort event (as it illustrated in the corresponding topic). However, the Settings.AllowSort option should not be disabled.
Custom Sorting example:
RepositoryItemHyperLinkEdit hlnkEditor;
private void GridCustomSortTest_Load(object sender, EventArgs e)
{
string[] months = new string[] { "January", "February", "March",
"April", "May", "June", "July", "August", "September",
"October", "November", "December" };
hlnkEditor = new RepositoryItemHyperLinkEdit();
//hlnkEditor.Buttons[0].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;
grid.DataSource = months;
grid.RefreshDataSource();
gridView1.Columns[0].SortMode = DevExpress.XtraGrid.ColumnSortMode.Custom;
gridView1.Columns[0].ColumnEdit = hlnkEditor;
gridView1.CustomColumnSort += new DevExpress.XtraGrid.Views.Base.CustomColumnSortEventHandler(gridView1_CustomColumnSort);
}
void gridView1_CustomColumnSort(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnSortEventArgs e)
{
e.Result = Comparer<int>.Default.Compare(e.ListSourceRowIndex1,
e.ListSourceRowIndex2);
e.Handled = true;
}
Hope this help..
Edit:
For Server side sorting and paging please go through example -
Bind a grid to a ObjectDataSource with EnablePaging and there also check the see also links.
More References:
How can I get the grid to sort my ObjectDataSource on the server?
Passing Gridview Paging/Sorting/Grouping/Filtering expressions to business logic Select Methods
ASPxGridView - ObjectDataSource Paging and Filtering
Performance comparison of XPO and Entity Frameworks, and ObjectDataSource
Binding with Large data:
Binding to Data
Binding to Large Data (Database Server Mode)
A possible implementation of IListServer interface to achieve Server Mode functionality