Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6757633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:40:34+00:00 2026-05-26T13:40:34+00:00

JLAdjustmentList.aspx.cs protected void Page_Load(object sender, EventArgs e) { LoadApprovalList(); } protected override void OnPreRender(EventArgs

  • 0

JLAdjustmentList.aspx.cs

    protected void Page_Load(object sender, EventArgs e) {
            LoadApprovalList();
        }

        protected override void OnPreRender(EventArgs e) {
            base.OnPreRender(e);
            gridAdjustments.DataBind();
        }

        protected void gridAdjustments_OnSorting(object sender, EventArgs e) {
            LoadApprovalList();
        }

        private void LoadApprovalList() {
            if (PermissionHelper.IsPermissionGranted(Permission.JLAdjustmentView)) {
                gridAdjustments.DataSource = Facade.AdAdjustment.GetListForAdministrator();
                Page.Title = "JL Adjustments List";
            } else if (PermissionHelper.IsPermissionGranted(Permission.JLAdjustmentApprove)) {
                gridAdjustments.DataSource =
                    Facade.AdAdjustment.GetListForAdministrator();
                Page.Title = "JL Adjustments Approval";
            } else if (PermissionHelper.IsPermissionGranted(Permission.JLAdjustmentEdit)) {
                gridAdjustments.DataSource =
                    Facade.AdAdjustment.GetListForManager(Current.User.Id);
                Page.Title = "JL Adjustments List";
            }
        }

        protected string GetBillableHours(AdAdjustmentListData adjustmentListData) {
            return TimeFormat.MinutesToString(adjustmentListData.BillableHoursSum);
        }

        protected string GetNonBillableHours(AdAdjustmentListData adjustmentListData) {
            return TimeFormat.MinutesToString(adjustmentListData.NonBillableHoursSum);
        }

        protected string GetDetailLink(AdAdjustmentListData adjustmentListData) {
            if (PermissionHelper.IsPermissionGranted(Permission.JLAdjustmentEdit)) {
                return string.Format("~/JLAdjustmentEdit.aspx?Id={0}", adjustmentListData.AdjustmentId);
            }
            return string.Format("~/JLAdjustmentView.aspx?Id={0}", adjustmentListData.AdjustmentId);
        }
    }
}

JLAdjustmentList.aspx

<it:GridView runat="server" ID="gridAdjustments" CssClass="object_list" OnSorting="gridAdjustments_OnSorting">
        <Columns>
            <it:BoundField DataField="AdjustmentId" HeaderText="Id" SortExpression="AdjustmentId" />
            <it:BoundField DataField="Week.DisplayName" HeaderText="Week Ending Date" SortExpression="Week.DisplayName" />
            <it:BoundField DataField="EmployeeFullName" HeaderText="USERID" SortExpression="EmployeeFullName" />
            <it:BoundField DataField="DepartmentFullName" HeaderText="Department" SortExpression="DepartmentFullName" />
            <it:BoundField DataField="Portfolio" HeaderText="Portfolio" SortExpression="Portfolio" />
            <asp:TemplateField HeaderText="Billable Hours Changed">
                <ItemStyle Width="70px"></ItemStyle>
                <ItemTemplate>
                    <%# GetBillableHours((AdAdjustmentListData)Container.DataItem) %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Non-Billable Hours Changed">
                <ItemStyle Width="70px"></ItemStyle>
                <ItemTemplate>
                    <%# GetNonBillableHours((AdAdjustmentListData)Container.DataItem)%>
                </ItemTemplate>
            </asp:TemplateField>
            <it:BoundField DataField="Reason" HeaderText="Reason For Adjustment" />
            <it:BoundField DataField="StatusName" HeaderText="Status" SortExpression="StatusName" />
            <it:BoundField DataField="LastChangedDateFormatted" HeaderText="Date of Last Action" />
            <asp:TemplateField HeaderText="Details">
                <ItemTemplate><center>
                    <asp:ImageButton runat="server" ImageUrl="~/img/edit.gif" 
                        PostBackUrl='<%# GetDetailLink((AdAdjustmentListData)Container.DataItem) %>' /></center>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </it:GridView>

SortHelper.cs

 public static class SortHelper {
        private static Dictionary<Type, Dictionary<String, ITypedSorter>> cache;

        static SortHelper() {
            cache = new Dictionary<Type, Dictionary<String, ITypedSorter>>();
        }

        public static IEnumerable Sort(this IEnumerable enumerable, string propertyName, bool desc) {
            if (enumerable != null) {
                if (enumerable is IQueryable) {
                    var itemType = (enumerable as IQueryable).ElementType;
                    var sorter = EnsureSorter(itemType, propertyName);
                    return sorter.Sort(enumerable, desc);
                }
                else {
                    var enumerator = enumerable.GetEnumerator();
                    enumerator.Reset();
                    if (enumerator.MoveNext()) {
                        var itemType = enumerator.Current.GetType();
                        var sorter = EnsureSorter(itemType, propertyName);
                        return sorter.Sort(enumerable, desc);
                    }
                }
            }
            return enumerable;
        }

I keep getting a “Specified method is not supported.” AT if (enumerator.MoveNext()) {

Stacktrace

  at Microsoft.Data.Extensions.Materializer`1.<Materialize>d__0.System.Collections.IEnumerator.Reset()
   at satispu.Utils.Helpers.SortHelper.Sort(IEnumerable enumerable, String propertyName, Boolean desc) in D:\Documents and Settings\aolaol\Desktop\Source_Build2\satispu.Utils\Helpers\SortHelper.cs:line 24
   at satispu.Web.Controls.GridView.OnDataBinding(EventArgs e) in D:\Documents and Settings\aolaol\Desktop\Source_Build2\satispu.Web\Controls\GridView.cs:line 119
   at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
   at System.Web.UI.WebControls.GridView.DataBind()
   at satispu.Web.JournalAdjustmentList.OnPreRender(EventArgs e) in D:\Documents and Settings\aolaol\Desktop\Source_Build2\satispu.Web\JournalAdjustmentList.aspx.cs:line 19
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

What could be the issue or What would you reccomend to fix this or to enable sorting is this gridview.

Heres The Call

public IEnumerable<ADAdjustmentListData> Adjustment_GetListForAdministrator(int year) {
    return this.CreateStoreCommand(
        "GetListForAdministrator",
        CommandType.StoredProcedure,
        new SqlParameter("@Year", year)
    ).Materialize<ADAdjustmentListData>();
}




  void GridView_Sorting(object sender, System.Web.UI.WebControls.GridViewSortEventArgs e) {
            if (!String.IsNullOrEmpty(e.SortExpression)) {
                ToggleSorting(e);
            }
            if (Sorting != null) {
                e.SortDirection = SortDirection;
                Sorting(sender, e);
            }
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:40:35+00:00Added an answer on May 26, 2026 at 1:40 pm

    I assume you are using Entity Framework or LINQ to SQL… If so, you are using SortHelper inside of a LINQ query, which is going against the database. when it does that, it tries to translate SortHelper to SQL, it fails to do so, and throws that error. For instance, if you do this:

    var q = from o in ctx.Users select new { SortedResults = SortHelper.Sort(q) };
    

    This will fail because it will try to translate SortHelper.Sort to a SQL method. But this will work OK only if it doesn’t modify the resultset in a way it doesn’t expect.

    var q = from o in ctx.Users select o;
    return SortHelper.Sort(q);
    

    The best way to ensure it will work is to call ToList() after the query – ToList() executes the query and then everything after is a LINQ to Objects operation:

    var q = (from o in ctx.Users select o).ToList();
    return SortHelper.Sort(q);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.