Double Update on A Gridview

Discussion in 'C#' started by aspshadow, Mar 11, 2009.

  1. #1
    We all know we can update values on a grid view, simply click on edit, change a value and hit update..easy..

    but what if you want to update a value on a second table, maybe one that is displayed on a different page? why maybe cuz a change in table1 that's currently displayed on the page affects, or should affects a value on table2, kinda of like a foreign key relationship.

    My problem is, it works, I can update multiple tables from my gridview but I have to go to edit, change a value , and update twice before the value on the second table changes, it retains the original value on the first update!! its driving me crazy , no one can figure how to get around this.

    So pretty much does any one know how to double post back when i hit update on my gridview, or double update with one post? Im assuming maybe i can overide the update method (im using C) and have it post twice? please any ideas would be helpful. thanks! examples please if you can:

    here's a visual example:

    Original table values:
    where the updatecommand is: Names2.john=Names.john

    [NAMES] [NAMES2]
    john 5 john 5
    william 10 william 10

    lets say i change john's score to 8

    i go edit ----> change johns score to 8 and hit update: .............the tables then are as follows:

    [NAMES] [NAMES2]
    john 8 john 5
    william 10 william 10

    THIS IS PROBLEM, ITS HERE!! were i want the table [NAMES2] to also update john's value just like it did for john in [NAMES] with one update

    but instead i have to go to edit and update again and finally [NAMES2] will update:

    [NAMES] [NAMES2]
    john 8 john 8
    william 10 william 10

    anybody have any idea?
     
    aspshadow, Mar 11, 2009 IP
  2. vihutuo

    vihutuo Well-Known Member

    Messages:
    1,511
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    180
    #2
    You can update the 2nd table in the RowUpdated event of the gridview.
     
    vihutuo, Mar 13, 2009 IP
  3. aspshadow

    aspshadow Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Can you please show me a quick example or direct me to where i can find one? thanks!
     
    aspshadow, Mar 15, 2009 IP