Stopping Repeated Form Submission

Discussion in 'ASP .Net' started by KV, Apr 28, 2004.

  1. KV

    KV Guest

    I need to stop the user from getting the following message:

    "The page cannot be refreshed without resending the information.
    Click Retry to send the information again,
    or click Cancel to return to the page that you were trying to view."

    OR, I need to stop the form button from being activated again and again.

    In my situation, I have a form with labels, text boxes, and a datagrid.
    Every time I add something to the text boxes and click on the button, the
    database is updated and the datagrid is refreshed. If the form is refreshed
    and I click on "retry", then the database gets updated again with the same
    information from the text boxes (as if I clicked the button). This is
    undesirable, since I'm getting many duplicate records.

    I added a "if not ispostback" statement and it takes care of the problem.
    But now my datagrid doesn't display right, because I need those records
    added to the database once whenever the form is submitted. So now I'm
    caught in between a rock and a hard place. If I keep the logic in I get
    dups, if I limit it then the datagrid never gets updated until the page is
    manually refreshed.

    Any ideas?

    -Kevin
    KV, Apr 28, 2004
    #1
    1. Advertising

  2. KV

    bruce barker Guest

    you should add a transaction guid to every page, and log if its been
    processed, this way you can ignore double postbacks, but the user can
    resubmit if the transaction failed (deadlock), or was lost in the internet,
    or IE failed to post correctly.

    -- bruce (sqlwork.com)


    "KV" <> wrote in message
    news:...
    > I need to stop the user from getting the following message:
    >
    > "The page cannot be refreshed without resending the information.
    > Click Retry to send the information again,
    > or click Cancel to return to the page that you were trying to view."
    >
    > OR, I need to stop the form button from being activated again and again.
    >
    > In my situation, I have a form with labels, text boxes, and a datagrid.
    > Every time I add something to the text boxes and click on the button, the
    > database is updated and the datagrid is refreshed. If the form is

    refreshed
    > and I click on "retry", then the database gets updated again with the same
    > information from the text boxes (as if I clicked the button). This is
    > undesirable, since I'm getting many duplicate records.
    >
    > I added a "if not ispostback" statement and it takes care of the problem.
    > But now my datagrid doesn't display right, because I need those records
    > added to the database once whenever the form is submitted. So now I'm
    > caught in between a rock and a hard place. If I keep the logic in I get
    > dups, if I limit it then the datagrid never gets updated until the page is
    > manually refreshed.
    >
    > Any ideas?
    >
    > -Kevin
    >
    >
    bruce barker, Apr 28, 2004
    #2
    1. Advertising

  3. KV

    KV Guest

    Thanks for the pointer. I did a search for "transaction guide" (looking for
    code samples) but didn't come up with anything. What's the easiest way to
    implement a transaction guide?

    -Kevin
    KV, Apr 28, 2004
    #3
    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. Leon Shaw

    (onetime) Form Submission

    Leon Shaw, Aug 15, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    355
  2. KV
    Replies:
    2
    Views:
    509
  3. John Kotuby

    Validation Controls not stopping Form Post

    John Kotuby, Feb 5, 2008, in forum: ASP .Net
    Replies:
    7
    Views:
    2,542
    Mark Rae [MVP]
    Feb 7, 2008
  4. mark r
    Replies:
    2
    Views:
    134
    mark r
    Jun 3, 2007
  5. Jared
    Replies:
    5
    Views:
    210
    Jared
    Jul 10, 2003
Loading...

Share This Page