還有壹個常用的屬性:SortDirection。
下面的例子可以很好地看出它的用法:
受保護的void kjkm_dg_SortCommand(對象源,DataGridSortCommandEventArgs e)
{
string sort expression = e . sort expression . tostring();//獲取當前排序表達式
string SortDirection = " ASC//給排序方向變量賦壹個初始值。
If(sort expression = = kjkm _ DG . attributes[" sort expression "])//如果是當前排序列,
{
SortDirection = (kjkm_dg。屬性["SortDirection"]。ToString() == SortDirection?《desc》:“ASC”);//獲取下壹個排序狀態。
}
kjkm_dg。attributes[" sort expression "]= sort expression;
kjkm_dg。attributes[" sort direction "]= sort direction;
Mike catbind();
}