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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Paging in Datagrid

Paging in Datagrid

Scheduled Pinned Locked Moved ASP.NET
helpcssquestion
2 Posts 2 Posters 2 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.
  • D Offline
    D Offline
    DuckFace
    wrote on last edited by
    #1

    Hi! I have a problem with paging in my datagrid. I have two grids and when I select one item in one grid it is transfered to another grid(and table). The problem is that when I select the last item on one page I get an error: <"Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount."> The item is transfered, but there are some problems when I call the gridbind-method to display the grid with one page lesser. How can I get through this. I've tried custom paging and regular. And many other things ;) Please help me :-)

    M 1 Reply Last reply
    0
    • D DuckFace

      Hi! I have a problem with paging in my datagrid. I have two grids and when I select one item in one grid it is transfered to another grid(and table). The problem is that when I select the last item on one page I get an error: <"Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount."> The item is transfered, but there are some problems when I call the gridbind-method to display the grid with one page lesser. How can I get through this. I've tried custom paging and regular. And many other things ;) Please help me :-)

      M Offline
      M Offline
      Mariusz Wojcik
      wrote on last edited by
      #2

      It's hard to tell why (no source), but you have some bug in the code. As I presume, you're deleting item from 1st table after it's transfered to the 2nd table. If you do that, it's possible to get an error like this when you delete an item, and there was only one item on the last page. Put this code in yours DataBinding method (after databind):

      if (DataGrid1.CurrentPageIndex >= DataGrid1.PageCount)
      DataGrid1.CurrentPageIndex = DataGrid1.PageCount - 1;

      It should help ;) -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

      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