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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:45:23+00:00 2026-05-27T21:45:23+00:00

var skip = selectedPage*pageSize; var take = Math.Min(result.DataSourceCount – skip, pageSize); List<SENTINEL_OPERATION> results =

  • 0
var skip = selectedPage*pageSize;
            var take = Math.Min(result.DataSourceCount - skip, pageSize);

            List<SENTINEL_OPERATION> results = sentinelOperationManager.SearchSentinelOperations(sid).Skip(skip).Take(take).ToList();

My last page always gets empty. Im using a PageDataSource to get the pagesize and sending the clicked page using jquery ajax get. Did i miss something? Thanks

  • 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-27T21:45:23+00:00Added an answer on May 27, 2026 at 9:45 pm

    I bet, that selectedPage starts from 1 in your code and this is causing erros. Then you get skip == pageSize when on first page, and you go “out of range” on last page, but you are skipping the “real” first page.

    If selectedPage starts from 1, then change this formula to:

    var skip = (selectedPage - 1 ) * pageSize;
    

    Also – there is no need to manually calculate take value. You can just pass pageSize and it will always work. If your data source will not contain enough elements, nothing wrong will happen, just elements that are available will be returned.

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

Sidebar

Related Questions

The following code: using (var db = new Entities()) { db.Blogs.First().Posts.Skip(10).Take(5).ToList(); } Will generate
When I write: var tagType = _reader.ReadByte(); while (tagType != 8) { var skip
suppose i am getting HTML text in my JavaScript function as var TEMP= result.data;
List<string> liste = new List<String> { A,B,C,D }; foreach (var item in liste) {
Using LINQ to SQL db.Products.Where(c => c.ID == 1).Skip(1).Take(1).ToList(); executes SELECT [t1].[ID], [t1].[CategoryID], [t1].[Name],
If I had this: var percentDiscount; function calculate(sale, original) { percentDiscount = Math.round(eval(((original-sale)/original) *
I'm trying to skip and take from a query, but get the casting errors:
List<string> urls = this.populateRequestList(); this.Logger(Starting); var reqs = urls.Select<string, WebRequest>(HttpWebRequest.Create).ToArray(); var iars = reqs.Select(req
I have the following test for skip take - [Test] public void RavenPagingBehaviour() {
var item = list.Where(t => somecondition); I would love to be able to find

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.