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. DataGrid

DataGrid

Scheduled Pinned Locked Moved ASP.NET
help
4 Posts 4 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
    Lost User
    wrote on last edited by
    #1

    I am using datagrid to display data with Paging to move one page to another page. I have a delete button also, which is used to delete all records which user selected in datagrid with the help of check box. But when I select all records of Last page and Try to delete it gives Error. Error: Invalid current PageIndex value. It must be>=0 and

    U J A 3 Replies Last reply
    0
    • L Lost User

      I am using datagrid to display data with Paging to move one page to another page. I have a delete button also, which is used to delete all records which user selected in datagrid with the help of check box. But when I select all records of Last page and Try to delete it gives Error. Error: Invalid current PageIndex value. It must be>=0 and

      U Offline
      U Offline
      User 2071301
      wrote on last edited by
      #2

      It may be due to reason that your page index get changed after delision. after delision set current page index as 1

      1 Reply Last reply
      0
      • L Lost User

        I am using datagrid to display data with Paging to move one page to another page. I have a delete button also, which is used to delete all records which user selected in datagrid with the help of check box. But when I select all records of Last page and Try to delete it gives Error. Error: Invalid current PageIndex value. It must be>=0 and

        J Offline
        J Offline
        jinnyb
        wrote on last edited by
        #3

        Make the page index of the datagrid =1 in the page load event Patel Neelesh A

        1 Reply Last reply
        0
        • L Lost User

          I am using datagrid to display data with Paging to move one page to another page. I have a delete button also, which is used to delete all records which user selected in datagrid with the help of check box. But when I select all records of Last page and Try to delete it gives Error. Error: Invalid current PageIndex value. It must be>=0 and

          A Offline
          A Offline
          azam316
          wrote on last edited by
          #4

          Place the following check exactly before calling the DataGrid.DataBind() method: // Get the total number of records returned from the database table. int totalRecords = Dataset.Tables[Index].Rows.Count; int totalRecordsAssumption = DataGrid.PageSize * DataGrid.CurrentPageIndex; if( totalRecords <= totalRecordsAssumption && totalRecords != 0 ) { DataGrid.CurrentPageIndex = DataGrid.CurrentPageIndex - 1; } Hopefully this will solve your problem!! Tell me if u have any problems with it Regards ☺«««DTA»»»☺

          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