Refreshing a page causes databound gridview to re update datasource.

Discussion in 'ASP .Net' started by Mike Grace, May 8, 2006.

  1. Mike Grace

    Mike Grace Guest

    Hi,

    I have a gridview which is using a SqlDataSource to update a table.

    The SqlDatasource is using a stored procedure to update the table.

    If I edit a row, change a value and click update the change is successfully
    applied to the SQL table.

    After this, the values in the underlying table could be changed by another
    process

    If I click the refresh button, when the page is redisplayed (after clicking
    retry on the warning), the underlying table is updated with the old values
    that were in the grid.

    This is obviously very dangerous.

    How can I stop this from happening?

    Surely when the page is refreshed, it shouldn't reapply the updates or am I
    missing something.


    Regards


    Mike
    Mike Grace, May 8, 2006
    #1
    1. Advertising

  2. Mike Grace

    Brock Allen Guest

    > Surely when the page is refreshed, it shouldn't reapply the updates or
    > am I missing something.


    Have you ever read the dialog that pops up when you try to refresh after
    you've previously submitted a form? The dialog usually tries to tell you
    that if you hit "OK" you're going to cause the browser to repeat thelast
    thing you did, which was a submit. This is a problem and is solved by either
    1) user education, or if that's difficult 2) after the submit and all your
    data's been saved to the database, use something like Response.Redirect(Request.Path)
    to get the user back to a 'fresh' page.

    -Brock
    http://staff.develop.com/balle
    Brock Allen, May 12, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?YW55ZW9uZQ==?=
    Replies:
    0
    Views:
    539
    =?Utf-8?B?YW55ZW9uZQ==?=
    Dec 19, 2005
  2. rodchar
    Replies:
    0
    Views:
    379
    rodchar
    Nov 26, 2007
  3. ritika_v
    Replies:
    1
    Views:
    282
    ritika_v
    Apr 1, 2008
  4. jazzMan007

    1 DataSource to Man DataBound Controls

    jazzMan007, Jan 12, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    105
    jazzMan007
    Jan 12, 2006
  5. Manu
    Replies:
    0
    Views:
    159
Loading...

Share This Page