GridColumnView Telerik 中的排序方向

Sort direction in GridColumnView Telerik

我在使用 Telerik 时让 SortDirection 处理我的代码时遇到问题。实际的后端代码如下所示:

private void SaveColumnSort(GridViewColumn dataGridColumn, string type)
  {
     var sortDirection = string.Empty;
     if (dataGridColumn.SortDirection == null)
     {
        sortDirection = "ASC";
     }
     else if (dataGridColumn.SortDirection == ListSortDirection.Ascending)
     {
        sortDirection = "DESC";
     }
     else
     {
        sortDirection = "ASC";
     }

     var sort = string.Format("{0};{1}", dataGridColumn.Header, sortDirection);

     if (type == "Claims")
     {
        PopulationOverlayInstance.Settings.RegOverlayClaimsColumnSort = sort;
     }
     else
     {
        PopulationOverlayInstance.Settings.RegOverlayChargesColumnSort = sort;
     }

     PopulationOverlayInstance.Settings.Save();
  }

datagridcolumn.sortdirection 表示无法解析 sortdirection 符号。我尝试将顶部的 GridViewColumn 更改为其他内容,但没有成功。

这一切都在 radgridview 中

private void SaveColumnSort(GridViewColumn gridViewColumn, string type)
  {
     var sortDirection = string.Empty;
     switch (gridViewColumn.SortingState)
     {
        case SortingState.None:
           sortDirection = "ASC";
           break;
        case SortingState.Ascending:
           sortDirection = "DESC";
           break;
        default:
           sortDirection = "ASC";
           break;
     }

     var sort = string.Format("{0};{1}", gridViewColumn.Header, sortDirection);

     switch (type)
     {
        case "Claims":
           PopulationOverlayInstance.Settings.RegOverlayClaimsColumnSort = sort;
           break;
        case "Charges":
           PopulationOverlayInstance.Settings.RegOverlayChargesColumnSort = sort;
           break;
     }

     PopulationOverlayInstance.Settings.Save();
  }