473,508 Members | 2,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refreshing the browser after an insert creates an additional record

Hello,

This problem came up during testing. There's a button on the page and
when a user selects the button, a row is added to the database.

If the user refreshes the browser (View | Refresh or F5) then a
duplicate of the previously inserted record is added to the database.

Calling dispose on the table adapter inside the event handler for the
button click doesn't help.

Suggestions are greatly appreciated.

Thanks!

Jun 2 '06 #1
3 946
> Suggestions are greatly appreciated.

Did the browser prompt you with a dialog after you hit refresh? The dialog
says something like "I'm going to do the POST again -- you sure that's what
you wanted?"

It's a user education issue. Educate the users the meaning of the dialog.
If that's insurmountable, after the update do a Response.Redirect(Request.Path)
to bring them into the page as if it were for the first time. That way if
they hit refresh it'll just be a GET again.

-Brock
http://staff.develop.com/ballen
Jun 2 '06 #2
you will have the same issue with the back button. its better practice to
code your site to support reposting of the same data. site that display
messages like "don't hit send again or you''l be charged twice" are just
bush league.

-- bruce (sqlwork.com)
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:b8************************@msnews.microsoft.c om...
Suggestions are greatly appreciated.


Did the browser prompt you with a dialog after you hit refresh? The dialog
says something like "I'm going to do the POST again -- you sure that's
what you wanted?"

It's a user education issue. Educate the users the meaning of the dialog.
If that's insurmountable, after the update do a
Response.Redirect(Request.Path) to bring them into the page as if it were
for the first time. That way if they hit refresh it'll just be a GET
again.

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

Jun 2 '06 #3
Thanks for the reply... I have some inline comments to your response
below...
bruce barker (sqlwork.com) wrote:
you will have the same issue with the back button. its better practice to
code your site to support reposting of the same data.
I'm new to ASP; I though when I called DataBind it did that... could
you extrapolate what you mean by "its better practice to code your site
to support reposting of the same data."
site that display
messages like "don't hit send again or you''l be charged twice" are just
bush league.


I wholeheartedly agree... and it never ceases to amaze me with what
users can find -- no matter how comprehensive I believe a given test
case to be.

Jun 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
4988
by: Philo Del Middleston | last post by:
I've been searching, but apparently not phrasing my search right, so I'm going to float a question out here in the meantime... I'm wondering how to go about refreshing the content of a control...
5
2435
by: Foreman | last post by:
Using ASPFileUpload (http://support.microsoft.com/default.aspx?scid=kb;en-us;299692) and works for IE6 and FireFox but not Safari. Thanks in advance for your assistance.
1
1092
by: Ian Walsh | last post by:
I have two pages in my project. Page 1 has a command button that when it is clicked inserts a record in a database and does a server.transfer to Page2. The problem is, if I do a refresh when...
20
5594
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
3
3427
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
6
3440
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
1
4928
by: romerve | last post by:
Hello; i am having some problems trying to get a form that has a datagridview to refresh after a new record is created. I have a MDI container and menu form and add new record form; the menu...
1
2299
by: d-42 | last post by:
Hi, I'm trying to use FormView to Insert an Object to an ObjectDataSource. The insert method signature is simply: void DALObject.InsertPerson(Person myObject) The person object for the...
4
2174
by: =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post by:
We’re storing our main entity in an insert only table which stores the history of past revisions, but we’re facing problems with storing this history as LINQ will only update the entity, and...
0
7227
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7391
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5633
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5056
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
424
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.