Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Page indexing in c#

Page indexing in c#

Scheduled Pinned Locked Moved C#
csharpcssdatabasetutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sajjad Leo
    wrote on last edited by
    #1

    Dear All, I am working on grid view i wana to assign paging index as like in google page with a constant range like 1 to 25. Can any one guide me what i have to do for this Please do replay..

    M 1 Reply Last reply
    0
    • S Sajjad Leo

      Dear All, I am working on grid view i wana to assign paging index as like in google page with a constant range like 1 to 25. Can any one guide me what i have to do for this Please do replay..

      M Offline
      M Offline
      musefan
      wrote on last edited by
      #2

      well you could load all your rows into a datatable or something, then you create a bunch of buttons to act as page numbers, or a drop down list, based on the number of rows in the datatable. So if you have 128 rows you could do...

      int numberOfPages = numRows % 25 == 0 ? numRows / 25 : numRows / 25 + 1;

      then on each button click, you load the first 25 result starting at a number obtained by...

      int startRowNumber = (pageNumber - 1) * 25;

      Alternatively you can get the startRowNumber and search you datasource for each page load. Depending on what your data source is will depend how you could do this. Some databases have functionality to specify a results count and start value. But you will have to look into that yourself

      Life goes very fast. Tomorrow, today is already yesterday.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups