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. Web Development
  3. ASP.NET
  4. Error with Datagrid paging

Error with Datagrid paging

Scheduled Pinned Locked Moved ASP.NET
help
4 Posts 3 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.
  • L Offline
    L Offline
    Lash20
    wrote on last edited by
    #1

    I get the ffg error when paging through a datagrid. There seems to be different permutations of this error. I have included below the steps to recreate the error. I would greatly appreciate any help I can get. ****Error Message**** System.Web.HttpException: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount ****Steps to recreate error**** * I list search results in a datagrid. * User clicks the "Next" button. New set of result is displayed. * User clicks the hyperlink on the datagrid cell. User is taken to a different page. * User clicks the browser "Back" button. * User clicks the "Next" button on the datagrid. * Error occurs.

    B T 2 Replies Last reply
    0
    • L Lash20

      I get the ffg error when paging through a datagrid. There seems to be different permutations of this error. I have included below the steps to recreate the error. I would greatly appreciate any help I can get. ****Error Message**** System.Web.HttpException: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount ****Steps to recreate error**** * I list search results in a datagrid. * User clicks the "Next" button. New set of result is displayed. * User clicks the hyperlink on the datagrid cell. User is taken to a different page. * User clicks the browser "Back" button. * User clicks the "Next" button on the datagrid. * Error occurs.

      B Offline
      B Offline
      bond with the best
      wrote on last edited by
      #2

      Not exactly getting you.. seems that the problem occurs when you again visit the page having datagrid.. set the currentpageindex=0 where you are filling the datagrid.. update me... lokesh

      L 1 Reply Last reply
      0
      • L Lash20

        I get the ffg error when paging through a datagrid. There seems to be different permutations of this error. I have included below the steps to recreate the error. I would greatly appreciate any help I can get. ****Error Message**** System.Web.HttpException: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount ****Steps to recreate error**** * I list search results in a datagrid. * User clicks the "Next" button. New set of result is displayed. * User clicks the hyperlink on the datagrid cell. User is taken to a different page. * User clicks the browser "Back" button. * User clicks the "Next" button on the datagrid. * Error occurs.

        T Offline
        T Offline
        Talal Sultan
        wrote on last edited by
        #3

        It's not very clear but I think the error is either occurring in the itemCommand method when the user clicks Next, or when the page tries to reload (Page_Load). Maybe you should check those 2 methods and try step by step debugging. Another thing that just occurred to me: how are you redirecting to the new page? I haven't tried this but if you're using Response.Redirect("....",true); maybe you would consider changing the boolean to false and try. It's just an idea, no guarantees that it will work. When the setting is true, you're redirecting and terminating the execution of the current page, so by saying false, you would not terminate the execution and maybe this will allow the user to go back and continue working. Try it and let me know what happens :) Talal "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

        1 Reply Last reply
        0
        • B bond with the best

          Not exactly getting you.. seems that the problem occurs when you again visit the page having datagrid.. set the currentpageindex=0 where you are filling the datagrid.. update me... lokesh

          L Offline
          L Offline
          Lash20
          wrote on last edited by
          #4

          Hi Thanks for your response, Wouldn't setting the currentpageindex to zero make it default to the first page? The error occurs when I try paging to a new page right after clicking on the "back" button on the browser.

          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