2014-09-04 72 views

回答

0

處理的OnColumnSort事件爲您ASPxGridView如下:

protected void myGrid_CustomColumnSort(object sender, CustomColumnSortEventArgs e) 
{ 
    if (e.Column == null) 
     return; 

    if (!e.Column.FieldName.ToString().Equals("myColumnFieldName")) 
     return; 

    if (e.Value1 == DBNull.Value || e.Value1 == null) 
     e.Result = 1; 
    else 
     if (e.Value2 == DBNull.Value || e.Value2 == null) 
      e.Result = -1; 
     else 
      e.Result = Comparer.Default.Compare(e.Value1, e.Value2); 
    e.Handled = true; 
} 

,並設置SortMode屬性爲YOUT列:

<Settings SortMode="Custom" /> 
相關問題