/*protected void dgAddEditMLs_PageIndexChanged(object sender, DataGridPageChangedEventArgs e)
         * {
         *  this.PopulateML(false, -1, e.NewPageIndex);
         * }*/

        protected void dgAddEditMLs_SortCommand(object sender, DataGridSortCommandEventArgs e)
        {
            string sortDirection = String.Empty;

            if (!SortExpression.ToUpper().StartsWith(e.SortExpression) && !SortExpression.ToUpper().Trim().EndsWith("ASC"))
            {
                sortDirection = " asc";
            }
            else
            {
                sortDirection = (SortExpression.ToUpper().EndsWith("DESC")) ? " asc" : " desc";
            }
            this.SortExpression = e.SortExpression + sortDirection;

            this.PopulateML(false);

            foreach (DataGridColumn col in this.dgAddEditMLs.Columns)
            {
                if (col.Visible && col.SortExpression == e.SortExpression)
                {
                    col.HeaderStyle.CssClass = "selected " + ((sortDirection.ToUpper() != " DESC") ? "sortDown" : "sortUp");
                }
                else
                {
                    col.HeaderStyle.CssClass = ((col.HeaderStyle.CssClass == "hide") ? "hide" : string.Empty);
                }
            }
        }