private void PopulateSortItems(esDataSourceSelectEventArgs e)
        {
            //-----------------------------------------
            // Populate the esDataSourceSortItem's
            //-----------------------------------------
            if (e.Arguments.SortExpression != null && e.Arguments.SortExpression.Length > 0)
            {
                e.SortItems = new List <esDataSourceSortItem>();

                string[] entries = e.Arguments.SortExpression.Split(',');

                for (int i = 0; i < entries.Length; i++)
                {
                    esDataSourceSortItem sortItem = new esDataSourceSortItem();

                    string sortEntry = entries[i].TrimEnd().TrimStart();

                    //------------------------------------
                    // Determine the Sort Direction
                    //------------------------------------
                    int index = sortEntry.IndexOf(' ');

                    if (index == -1)
                    {
                        sortItem.Direction = esOrderByDirection.Ascending;
                    }
                    else if (sortEntry.Contains(" DESC") || sortEntry.Contains(" desc") || sortEntry.Contains(" Desc"))
                    {
                        sortItem.Direction = esOrderByDirection.Descending;
                    }
                    else
                    {
                        sortItem.Direction = esOrderByDirection.Ascending;
                    }

                    //------------------------------------
                    // Determine the Property Name
                    //------------------------------------
                    if (index == -1)
                    {
                        sortItem.Property = sortEntry;
                    }
                    else
                    {
                        sortItem.Property = sortEntry.Substring(0, index);
                    }

                    e.SortItems.Add(sortItem);
                }
            }
        }
        private void PopulateSortItems(esDataSourceSelectEventArgs e)
        {
            //-----------------------------------------
            // Populate the esDataSourceSortItem's
            //-----------------------------------------
            if (e.Arguments.SortExpression != null && e.Arguments.SortExpression.Length > 0)
            {
                e.SortItems = new List<esDataSourceSortItem>();

                string[] entries = e.Arguments.SortExpression.Split(',');

                for (int i = 0; i < entries.Length; i++)
                {
                    esDataSourceSortItem sortItem = new esDataSourceSortItem();

                    string sortEntry = entries[i].TrimEnd().TrimStart();

                    //------------------------------------
                    // Determine the Sort Direction
                    //------------------------------------
                    int index = sortEntry.IndexOf(' ');

                    if (index == -1)
                    {
                        sortItem.Direction = esOrderByDirection.Ascending;
                    }
                    else if (sortEntry.Contains(" DESC") || sortEntry.Contains(" desc") || sortEntry.Contains(" Desc"))
                    {
                        sortItem.Direction = esOrderByDirection.Descending;
                    }
                    else
                    {
                        sortItem.Direction = esOrderByDirection.Ascending;
                    }

                    //------------------------------------
                    // Determine the Property Name
                    //------------------------------------
                    if (index == -1)
                    {
                        sortItem.Property = sortEntry;
                    }
                    else
                    {
                        sortItem.Property = sortEntry.Substring(0, index);
                    }

                    e.SortItems.Add(sortItem);
                }
            }
        }