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. DataGridView Save changes cell only after leaving the row ?

DataGridView Save changes cell only after leaving the row ?

Scheduled Pinned Locked Moved C#
question
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.
  • U Offline
    U Offline
    unitecsoft
    wrote on last edited by
    #1

    Hi When changing a value in any cell in DataGridView , this value is saved into the related dataset only after the user clicks on an other cell in an other row ! Even the mecthod AcceptChanges() will not save the contents of this cell unless the user moves to an other row . I need to save these contents straight away without forcing the user to leave the cell . any Ideas ? thanx .

    L 1 Reply Last reply
    0
    • U unitecsoft

      Hi When changing a value in any cell in DataGridView , this value is saved into the related dataset only after the user clicks on an other cell in an other row ! Even the mecthod AcceptChanges() will not save the contents of this cell unless the user moves to an other row . I need to save these contents straight away without forcing the user to leave the cell . any Ideas ? thanx .

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      unitecsoft wrote:

      without forcing the user to leave the cell

      How will you know when the user is finished with editing then? Saving the current value at each keypress is going to be inefficient :(

      I are troll :)

      U 1 Reply Last reply
      0
      • L Lost User

        unitecsoft wrote:

        without forcing the user to leave the cell

        How will you know when the user is finished with editing then? Saving the current value at each keypress is going to be inefficient :(

        I are troll :)

        U Offline
        U Offline
        unitecsoft
        wrote on last edited by
        #3

        the problem is even if you save by clicking a SAVE button which will fire AcceptCanges() method , the contents of the cell are not saved unless the user previously leaves the row which include that cell .

        L 1 Reply Last reply
        0
        • U unitecsoft

          the problem is even if you save by clicking a SAVE button which will fire AcceptCanges() method , the contents of the cell are not saved unless the user previously leaves the row which include that cell .

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          If he clicks a save-button, doesn't that move the focus to the button (and out of the cell, triggering validates and such)?

          I are troll :)

          U 1 Reply Last reply
          0
          • L Lost User

            If he clicks a save-button, doesn't that move the focus to the button (and out of the cell, triggering validates and such)?

            I are troll :)

            U Offline
            U Offline
            unitecsoft
            wrote on last edited by
            #5

            Yes , but does not save the value of that cell !!! I don't know why !!! the only way to save it is to click a different ROW within the grid .

            L 1 Reply Last reply
            0
            • U unitecsoft

              Yes , but does not save the value of that cell !!! I don't know why !!! the only way to save it is to click a different ROW within the grid .

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              That shouldn't be happening, according to the documentation; "When you call AcceptChanges on the DataSet, any DataRow objects still in edit-mode end their edits successfully." (Source[^]) Can you post the offending code?

              I are troll :)

              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