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

  • SEARCH
  • Home
  • 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 8404481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:36:40+00:00 2026-06-09T22:36:40+00:00

I am getting following error while sorting on my gridview. The data source does

  • 0

I am getting following error while sorting on my gridview. “The data source does not support server-side data paging.” I am not using obejctdatasource and linqdatasource. Every example or solution on stack overflow I found is using obejctdatasource. [like: http://www.devtoolshed.com/content/gridview-objectdatasource-linq-paging-and-sorting%5D

Below is my code. How can I fix sorting error in my code? Can I fix it without using objectdatasource.


public List<SearchLoanViewItem> GetSearchresult(EmpowerEntities empower)
        {
            var searchresult = (from m in dbo.MTGTERMS
                                join p in dbo.PROPINFOes
                                    on m.LNKEY equals p.LNKEY
                                join b in dbo.BORRINFOes
                                    on m.LNKEY equals b.LNKEY
                                join d in dbo.DBLOCKS
                                    on m.LNKEY equals d.LNKEY
                                join u in dbo.UCODES3
                                    on m.LNKEY equals u.LNKEY
                                join c in dbo.CODES
                                    on m.LNKEY equals c.LNKEY
                                where b.WHICHBORR == 1
                                      && (c.APPSTATS == null ? "" : c.APPSTATS) != "DEL"
                                select new SearchLoanViewItem
                                           {
                                               lnkey = m.LNKEY,
                                               prop_addr = p.PROP_ADDR,
                                               networklocked = d.NETWORKLOCKED == "Y" ? "Yes" : "No",
                                               username = (d.USERNAME ?? ""),
                                               mailbox = d.MAILBOX,
                                               borr_name = b.BORR_NAME,
                                               ssn = b.BORR_SSN,
                                               phone = b.BORR_PHONE,
                                               employee_loan = (u.CODE67N ?? -1)
                                           }).Take(5).ToList();
            return searchresult;
        }


        public void ShowSearchResults()
        {
            try
            {
                var empower = new EmpowerEntities();
                var searchresult = GetSearchresult(empower);                

                gdvSearchResult.DataSource = searchresult;
                gdvSearchResult.DataBind();
            }
            catch (Exception ex)
            {
                Logger.log("ucSearchLoan", ex.Message, Logger.ERROR);
            }
        }


 protected void Paging_gdvSearchResult(object source, GridViewPageEventArgs e)
        {  
            gdvSearchResult.PageIndex = e.NewPageIndex;
            ShowSearchResults();
        }

protected void gdvSearchResult_SortCommand(object source, GridViewSortEventArgs e)
        {
            try
            {
                var empower = new EmpowerEntities();
                var searchresult = GetSearchresult(empower);

                if (SearchSortType == Constants.ASC)
                    SearchSortType = Constants.DESC;
                else
                    SearchSortType = Constants.ASC;

                SeachSortField = e.SortExpression.ToString();

                if (SeachSortField.Equals(Constants.ASC))
                    gdvSearchResult.DataSource = searchresult.AsEnumerable().OrderBy(a => a.GetType().GetProperty(SeachSortField).GetValue(a, null));
                else
                    gdvSearchResult.DataSource = searchresult.AsEnumerable().OrderByDescending(a => a.GetType().GetProperty(SeachSortField).GetValue(a, null));

                gdvSearchResult.DataBind();        

            }

and my gridview looks like below.

    <asp:GridView runat="server" ID="gdvSearchResult" 
             AutoGenerateColumns="false" OnRowCommand="gdvSearchResult_RowCommand" OnRowCreated="gdvSearchResult_RowCreated" PageSize="2" AllowPaging="true"      AllowSorting="true" OnPageIndexChanging="Paging_gdvSearchResult" OnSorting="gdvSearchResult_SortCommand">
  • 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-06-09T22:36:41+00:00Added an answer on June 9, 2026 at 10:36 pm

    Issue was fixed when I added casting [Cast<object>().ToList() part]

     if (SeachSortField.Equals(Constants.ASC))
                        gdvSearchResult.DataSource = searchresult.AsEnumerable().OrderBy(a => a.GetType().GetProperty(SeachSortField).GetValue(a, null)).Cast<object>().ToList();
                    else
                        gdvSearchResult.DataSource = searchresult.AsEnumerable().OrderByDescending(a => a.GetType().GetProperty(SeachSortField).GetValue(a, null)).Cast<object>().ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why i am getting following error while testing the application? App1 does not specify
i am getting following error while getting data from dictionary -[__NSCFString objectForKey:]: unrecognized selector
I'm getting the following error, while using ExtJs MVC, Uncaught TypeError: Cannot call method
I am getting following error while building my vc++ project (Using visual studio 2010)
I am getting the following error while trying to add a NOT NULL column
I am getting following error while using POCO entity width EF One or more
I am getting following error while i deployed the website.. Server Error in '/domain/website'
I am getting the following error while using ApiKeyAuthentication for my Tastypie resources when
I'm getting the following error while running the android application. Currently i'm using Windows
I am getting following error while exporting data to excel sheet ERROR: Message :

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.