public virtual void DisplayCurrentSortStates()
        {
            GridViewColumnCollection       columns          = GridViewDataControl.Columns;
            ISet <GridViewBoundColumnBase> unmatchedColumns = new IdentityHashSet <GridViewBoundColumnBase>();

            foreach (GridViewBoundColumnBase column in columns)
            {
                unmatchedColumns.Add(column);
            }

            foreach (AmbethSortDescriptor sortDescriptor in SortDescriptorList)
            {
                foreach (GridViewBoundColumnBase column in columns)
                {
                    if (column.GetDataMemberName() == sortDescriptor.Member)
                    {
                        column.SortingState = SortDescriptorConverter.GetTelerikSortingState(sortDescriptor);
                        unmatchedColumns.Remove(column);
                        break;
                    }
                }
            }
            foreach (GridViewBoundColumnBase unmatchedColumn in unmatchedColumns)
            {
                unmatchedColumn.SortingState = SortingState.None;
            }
        }
        public virtual void ControlSorting(Object sender, GridViewSortingEventArgs e)
        {
            // Sorting happens on server-side, hence the the own sorting of the UIControl must be
            // canceled and therefore, the SortingStates must be switched manually here.
            if (e.OldSortingState == SortingState.None)
            {
                e.NewSortingState = SortingState.Ascending;
            }
            else if (e.OldSortingState == SortingState.Ascending)
            {
                e.NewSortingState = SortingState.Descending;
            }
            else if (e.OldSortingState == SortingState.Descending)
            {
                e.NewSortingState = SortingState.None;
            }

            List <ISortDescriptor> sortDescriptorList = new List <ISortDescriptor>();
            bool modifiedOrRemoved = false;

            // Not only the EventArgs, but all SortDescriptors set on the Control must be evaluated.
            // (E.g. in a RadGridView, the user can specify multiple descriptors by holding the shift key)
            // As the Controls own sorting is canceled, the descriptors are not directly available from the
            // sender and must be tracked manually.
            if (!e.IsMultipleColumnSorting)
            {
                if (SortDescriptorList.Count > 0)
                {
                    SortDescriptorList.Clear();
                    modifiedOrRemoved = true;
                }
            }

            // The MemberName of the property to sort is currently still available as SortPropertyName in the
            // EventArgs, but it is marked as obsolet and thus removed in future versions. Therefore the PropertyName
            // will be evaluated by casting the the Column to a GridViewBoundColumnBase and calling its
            // GetDataMemberName() method.
            String sortPropertyName = ((GridViewBoundColumnBase)e.Column).GetDataMemberName();
            AmbethISortDescriptor ambethDescriptor = SortDescriptorConverter.ConvertTelerikSortingState(e.NewSortingState, sortPropertyName);

            foreach (AmbethSortDescriptor sortDescriptor in SortDescriptorList)
            {
                if (sortDescriptor.Member != sortPropertyName)
                {
                    continue;
                }
                if (ambethDescriptor != null)
                {
                    sortDescriptor.SortDirection = ambethDescriptor.SortDirection;
                    ambethDescriptor             = null;
                }
                else
                {
                    SortDescriptorList.Remove(sortDescriptor); // OK to remove directly, because break is following
                }
                modifiedOrRemoved = true;
                break;
            }

            if (ambethDescriptor != null)
            {
                SortDescriptorList.Add(ambethDescriptor);
                modifiedOrRemoved = true;
            }

            if (modifiedOrRemoved)
            {
                OnPropertyChanged("SortDescriptorList");
            }

            // As sorting is canceled for the control, the status of all other descriptors must be reset manually:
            //DisplayCurrentSortStates();

            e.Cancel = true; // Prevent the UIControl from own sorting
        }