Refresh and Button Click

Discussion in 'ASP .Net' started by Fabiano, May 30, 2005.

  1. Fabiano

    Fabiano Guest

    Hi there,

    Houston, i have a problem. :O)

    I have a page tha contains a datagrid and some textboxes. When the user
    clicks the ADD button, i need to insert the textbox data into a table and
    then refresh the datagrid data. Ok, but if my user clicks the browser's
    refresh button the ASP.NET fires the onClick button again, and again and
    again.

    I thought i could verify if the data already exists before insert it, but
    before this i would like to know if there is anyway i can solve this using
    ASP.NET fashion.

    Tks in adv.
    Fabiano
    Fabiano, May 30, 2005
    #1
    1. Advertising

  2. Fabiano

    Brock Allen Guest

    When the user hits the refresh button they are typically prompted by the
    browser. The prompt informs them that if they click 'yes' (or is it 'ok'?)
    that what the browser will do is execute the last thing the user did to get
    the page. If the past thing the user did was click the Add button, then that's
    what it will do. Unfortunately this is a user education issue.

    There are some things you can do to remove this possibility, such as a Response.Redirect
    back into the same page so that it reloads itself from scratch without the
    POST sideeffects, but since you're dynamically adding controls in the postback
    I think you're going to have a hard time.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi there,
    >
    > Houston, i have a problem. :O)
    >
    > I have a page tha contains a datagrid and some textboxes. When the
    > user clicks the ADD button, i need to insert the textbox data into a
    > table and then refresh the datagrid data. Ok, but if my user clicks
    > the browser's refresh button the ASP.NET fires the onClick button
    > again, and again and again.
    >
    > I thought i could verify if the data already exists before insert it,
    > but before this i would like to know if there is anyway i can solve
    > this using ASP.NET fashion.
    >
    > Tks in adv.
    > Fabiano
    Brock Allen, May 30, 2005
    #2
    1. Advertising

  3. Fabiano

    Joe Fallon Guest

    Dino Esposit wrote an article on a "Refresh Trapper" design.
    I have used it. It works to disallow these types of things.
    Try to google it.
    --
    Joe Fallon



    "Fabiano" <> wrote in message
    news:e0Yu$...
    > Hi there,
    >
    > Houston, i have a problem. :O)
    >
    > I have a page tha contains a datagrid and some textboxes. When the user
    > clicks the ADD button, i need to insert the textbox data into a table and
    > then refresh the datagrid data. Ok, but if my user clicks the browser's
    > refresh button the ASP.NET fires the onClick button again, and again and
    > again.
    >
    > I thought i could verify if the data already exists before insert it, but
    > before this i would like to know if there is anyway i can solve this using
    > ASP.NET fashion.
    >
    > Tks in adv.
    > Fabiano
    >
    Joe Fallon, May 31, 2005
    #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. Purvi T
    Replies:
    0
    Views:
    820
    Purvi T
    Oct 19, 2004
  2. brian lanning
    Replies:
    0
    Views:
    574
    brian lanning
    Jul 29, 2003
  3. Lenny Shprekher

    Button click and Page refresh issue.

    Lenny Shprekher, Feb 23, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    3,272
    Lenny Shprekher
    Feb 23, 2005
  4. Lenny Shprekher
    Replies:
    0
    Views:
    2,318
    Lenny Shprekher
    Feb 23, 2005
  5. Amy
    Replies:
    0
    Views:
    955
Loading...

Share This Page