Adf.Web.UI.SmartView.SmartView.OnSorting C# (CSharp) Method

OnSorting() protected method

Provides an override of GridView sorting.
protected OnSorting ( System.Web.UI.WebControls.GridViewSortEventArgs e ) : void
e System.Web.UI.WebControls.GridViewSortEventArgs
return void
        protected override void OnSorting(GridViewSortEventArgs e)
        {
            base.OnSorting(e);

            if (e.Cancel) return;

            if (e.SortExpression == _lastexpression)
            {
                _ascending = !_ascending;
            }
            else
            {
                _ascending = true;
                _lastexpression = e.SortExpression;
            }

            if (DataSource is IDomainCollection)
            {
                var source = (IDomainCollection) DataSource;

                source.Sort(e.SortExpression, (_ascending) ? SortOrder.Ascending : SortOrder.Descending);

                DataSource = source;
            }

            DataBind();
        }