Nullable 型は、null 許容型を比較するための比較メソッドを公開するため、解決策は、グリッドビューの並べ替えロジックをオーバーライドし、比較を手動で指定することです。
gridview.Sorting += new GridViewSortEventHandler(gridView_Sorting);
protected void gridView_Sorting(object sender, GridViewSortEventArgs e)
{
// Only add custom handling for the sort expression on the
// Nullable<int> column
if (e.SortExpression == "MySortExpression")
{
// Convert datasource to a List<T>
list.Sort(new Comparison<MyObjectType>(delegate(MyObjectType item1, MyObjectType item2)
{
return Nullable.Compare<int>(item1.NullableIntProp, item2.NullableIntProp);
}));
// Bind the sorted list back to the gridview
}
else
{
// delegate to the gridview to handle its own sorting
}
}