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. Delete last record on last page in DataGrid?

Delete last record on last page in DataGrid?

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netquestion
6 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.
  • J Offline
    J Offline
    jitendrapatel
    wrote on last edited by
    #1

    :)Hi, Friends, I have problem while using datagrid in Asp.Net. The DataGrid Control is very helpful me for paging, editing and deleting record. I put 2 button column one for Edit and second for Delete. When i going to last page on datagrid and if there is only one record on last then, when i click on delete then after deleting it gives me error. Please give me solution. I want to delete last record thanks in advance for who will me give solution. thanks. J. A. Patel

    G 1 Reply Last reply
    0
    • J jitendrapatel

      :)Hi, Friends, I have problem while using datagrid in Asp.Net. The DataGrid Control is very helpful me for paging, editing and deleting record. I put 2 button column one for Edit and second for Delete. When i going to last page on datagrid and if there is only one record on last then, when i click on delete then after deleting it gives me error. Please give me solution. I want to delete last record thanks in advance for who will me give solution. thanks. J. A. Patel

      G Offline
      G Offline
      gnjunge
      wrote on last edited by
      #2

      Let's say the datagrid had 5 pages, every page max 10 items. You deleted item 51, so page 5 doesn't exist anymore, but the user still stands on page 5, so that gives an error. This is the VB.NET solution:

      'put this is in your delete command of your datagrid
      

      and put this in your

      J 1 Reply Last reply
      0
      • G gnjunge

        Let's say the datagrid had 5 pages, every page max 10 items. You deleted item 51, so page 5 doesn't exist anymore, but the user still stands on page 5, so that gives an error. This is the VB.NET solution:

        'put this is in your delete command of your datagrid
        

        and put this in your

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

        Hi, gnjunge I got ur reply. thanks for that. I will apply this if any problem come then i will ask u so please ready to help me. U help me, so i m always ready to help u. If u want help from me u can ask me. Bye J. A. Patel

        G 1 Reply Last reply
        0
        • J jitendrapatel

          Hi, gnjunge I got ur reply. thanks for that. I will apply this if any problem come then i will ask u so please ready to help me. U help me, so i m always ready to help u. If u want help from me u can ask me. Bye J. A. Patel

          G Offline
          G Offline
          gnjunge
          wrote on last edited by
          #4

          No problem. I hope it works like this, I have the pageIndex stored in the ViewState, I forgot why I did that, but if you have a problem, i show you how to implement that viewstate thing.

          J 1 Reply Last reply
          0
          • G gnjunge

            No problem. I hope it works like this, I have the pageIndex stored in the ViewState, I forgot why I did that, but if you have a problem, i show you how to implement that viewstate thing.

            J Offline
            J Offline
            jitendrapatel
            wrote on last edited by
            #5

            Hi, Friends, thanks u. Code given by u is perfectly working i tested in my web pages and it works perfectly no problem comes. Thanks u very much to solving my problem If u have problem send me problem i can try to solve it. Bye. J. A. Patel

            G 1 Reply Last reply
            0
            • J jitendrapatel

              Hi, Friends, thanks u. Code given by u is perfectly working i tested in my web pages and it works perfectly no problem comes. Thanks u very much to solving my problem If u have problem send me problem i can try to solve it. Bye. J. A. Patel

              G Offline
              G Offline
              gnjunge
              wrote on last edited by
              #6

              Good to hear it worked out! bye, Gidon

              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