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 423193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:09:22+00:00 2026-05-12T19:09:22+00:00

I’m using a web service which returns a list of products. I created a

  • 0

I’m using a web service which returns a list of products. I created a Grid View programmatically and used the list as the datasource. However, I can’t use the Paging/Sorting methods as it causes errors since I’m not using an ObjectSource control. I handled the paging and sorting manually, but I don’t know if I’m doing it efficiently.
When the user clicks on a new page, I handle the page index changing like this:

protected void gvProductList_PageIndexChanging(object sender, GridViewPageEventArgs e)
{

    userProducts = Data.GetProductList();

    this.gvProductList.PageIndex = e.NewPageIndex;
    this.gvProductList.DataSource = userProducts;
    gvProductList.DataBind();
}

However, the database is always called when I change pages. Is there a way to make this more efficient, or is that normal for paging? The same goes for sorting, which uses the web service to get the products, then uses a lambda expression to sort the products according to various columns. Each time this happens, the database is called (in order to get the list of products again). Am I handling this wrongly? I know I can use sessions and such to store the List, but there can be hundreds of custom objects per list and tens of thousands of users at any one time.

I should note that the web service is provided by a third party (and so it’s their database being called), which means I won’t have access to the SQL Server itself nor any methods to change the web service.

Thanks for any help.

EDIT: I should mention that the product list is the user’s shopping cart. Therefore, it’s unique per user.

General Consensus: If the shopping cart isn’t holding many items, the current method would be okay. However, if caching is required, this can be achieved by either using In Proc sessions, or storing sessions on a SQL Server.

  • 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-12T19:09:22+00:00Added an answer on May 12, 2026 at 7:09 pm

    No, it’s not efficient since you are bringing back every record in the underlying database (presuming GetProductList() returns all records). The GridView paging just means it only shows the number of rows defined in PageSize for the given PageIndex – but it doesn’t effect how many records are actually returned from the datasource.

    Unfortunately, since you don’t have direct access to the database and the web-service doesn’t offer any other methods, then the best you can probably do is cache the data. Luckily asp.net makes cacheing data quite simple. The Cache object is rather like Session, except you only have one instance per application, not per user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words
We're building an app, our first using Rails 3, and we're having to build

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.