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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:24:46+00:00 2026-05-16T22:24:46+00:00

//Bind data this.IncomeGridView.DataSource = incomeData; //If incomeData is not empty then Taking the value

  • 0
//Bind data
this.IncomeGridView.DataSource = incomeData;
//If incomeData is not empty then Taking the value of the Id field of the first and the last row in data page
if (incomeData.Count() > 0)
{                    
   this.incomePaging_IdAtTheEndOfCurrentPage = incomeData.ToList()[incomeData.Count() - 1].Id;
   **this.incomePaging_IdAtTheStartOfCurrentPage = incomeData.ToList()[0].Id;**
}

I take a page data but at the bold line the incomeData object contains data of the next data page automatically. Why did the Entity Framework do like that?

  • 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-16T22:24:47+00:00Added an answer on May 16, 2026 at 10:24 pm

    If you have all items in the GridView, and you use the built-in paging over all the items (ie if incomeData contains all items, and the gridview shows a section of that), then you need to look at the first visible item of IncomeGridView.

    The best solution is using the PageIndex and PageSize columns:

    // Bind data
    this.IncomeGridView.DataSource = incomeData;
    
    // If incomeData is not empty then Taking the value of the Id field of the first 
    // and the last row in data page
    if (incomeData.Any())
    {         
        int pageSize = IncomeGridView.PageSize;
        int pageIndex = IncomeGridView.PageIndex;
    
        this.incomePaging_IdAtTheEndOfCurrentPage = incomeData
            .Skip(pageIndex * pageSize) // Skip pages before this page
            .Skip(pageSize -1)          // Skip all items except the last one
            .Take(1)                    // Take the last one
            .Id;
    
        this.incomePaging_IdAtTheStartOfCurrentPage = incomeData
            .Skip(pageIndex * pageSize) // Skip pages before this page
            .Take(1)                    // Take the first one
            .Id;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The default model binder does not seem to bind data in this scenario. Any
I have this code: Dim Result As New DataTable DataAdapter.Fill(Result) 'bind data to visible
With Knockout 2.0 using this data-bind: data-bind=click: $root.deleteSomeEntity.bind($data, $parent) in the Knockout viewmodel JavaScript
I have this code I want to bind data to grid view without using
I am getting user list using Membership.GetAllUsers() function. And I bind this data in
Is it possible to bind data in the wrong direction? I want a value
I have: function dosomething(data) { alert($(this).attr('class')) $(this).children('img').attr('title', data) } $('.test').bind('mouseover', function() { $.get('/inc/ajax-function.asp?action=check', dosomething);
I'm using LINQ to query data from database and then bind it to a
How to bind data to two columns listbox like this: | Item1 | Item2
I have a custom data-bind like this : ko.bindingHandlers.calendar = { init: function(element, valueAccessor)

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.