473,839 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET Refresh Problem

hello, i have a problem in refreshing a page. the problem happens when i
click a button that does a certain action in a web page, such as inserting a
record into the database, if now i refresh the page (press f5), the action
repeats itself and another identical record is inserted too.
i discovered that the button_click event is called when i refresh the page.
so the problem is that when i refresh the page, the last action that i have
done on the page is refired.
if anybody can tell me how to solve this problem ill be thankfull...
Nov 17 '05 #1
4 4146
You can't exactly solve it. What you can do is to handle it on the server.
For example, you could set a Session variable when the insert occurs, and
check it before doing the insert. If the Session variable is there, you know
the record has been inserted already. Of course, you have to remove the
Session variable at some point in order to do another insert. But of course,
there are ways of doing that as well. There are other solutions as well. How
you handle it is up to you, based upon the functionality of your page, and
your creativity.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"wright" <yl**@wintech-soft.com> wrote in message
news:eH******** ******@tk2msftn gp13.phx.gbl...
hello, i have a problem in refreshing a page. the problem happens when i
click a button that does a certain action in a web page, such as inserting a record into the database, if now i refresh the page (press f5), the action
repeats itself and another identical record is inserted too.
i discovered that the button_click event is called when i refresh the page. so the problem is that when i refresh the page, the last action that i have done on the page is refired.
if anybody can tell me how to solve this problem ill be thankfull...

Nov 17 '05 #2
You can't exactly solve it. What you can do is to handle it on the server.
For example, you could set a Session variable when the insert occurs, and
check it before doing the insert. If the Session variable is there, you know
the record has been inserted already. Of course, you have to remove the
Session variable at some point in order to do another insert. But of course,
there are ways of doing that as well. There are other solutions as well. How
you handle it is up to you, based upon the functionality of your page, and
your creativity.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"wright" <yl**@wintech-soft.com> wrote in message
news:eH******** ******@tk2msftn gp13.phx.gbl...
hello, i have a problem in refreshing a page. the problem happens when i
click a button that does a certain action in a web page, such as inserting a record into the database, if now i refresh the page (press f5), the action
repeats itself and another identical record is inserted too.
i discovered that the button_click event is called when i refresh the page. so the problem is that when i refresh the page, the last action that i have done on the page is refired.
if anybody can tell me how to solve this problem ill be thankfull...

Nov 17 '05 #3
The problem is that when you press F5 IE sends excatly same info to the
server.
And server can not distinguish between first request and second.

The easiest thing is to redirect to the page (it could be the same page).

George.

"wright" <yl**@wintech-soft.com> wrote in message
news:eH******** ******@tk2msftn gp13.phx.gbl...
hello, i have a problem in refreshing a page. the problem happens when i
click a button that does a certain action in a web page, such as inserting a record into the database, if now i refresh the page (press f5), the action
repeats itself and another identical record is inserted too.
i discovered that the button_click event is called when i refresh the page. so the problem is that when i refresh the page, the last action that i have done on the page is refired.
if anybody can tell me how to solve this problem ill be thankfull...

Nov 17 '05 #4
The problem is that when you press F5 IE sends excatly same info to the
server.
And server can not distinguish between first request and second.

The easiest thing is to redirect to the page (it could be the same page).

George.

"wright" <yl**@wintech-soft.com> wrote in message
news:eH******** ******@tk2msftn gp13.phx.gbl...
hello, i have a problem in refreshing a page. the problem happens when i
click a button that does a certain action in a web page, such as inserting a record into the database, if now i refresh the page (press f5), the action
repeats itself and another identical record is inserted too.
i discovered that the button_click event is called when i refresh the page. so the problem is that when i refresh the page, the last action that i have done on the page is refired.
if anybody can tell me how to solve this problem ill be thankfull...

Nov 17 '05 #5

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

Similar topics

9
4930
by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST == "") { include ("InsertRecord.inc"); // Insert new record }
4
5495
by: Noel Wood | last post by:
Hello, I have a problem that I'm sure is simple but I have searched the newsgroup and have not found it posted before so I apologize if it has been asked heaps of times before. I have a page that list all current orders from customers. Customers can order at any time. I have a checkbox beside each listing so that as each order is complete it can be ticked off. I want the page to refresh every 2 mins so I have added .... <meta...
3
12934
by: Scott | last post by:
I have a clickable graph that resides on page 1. If user clicks a data point on the graph, the page runs again yeilding a 2nd graph that shows a more detailed graph. Problem is, I have a recordset table on the 2nd graph page and because the user gets to it by clicking the graph, the page doesn't properly post to render the recordset table. I can click "Refresh" on 2nd page and table displays fine. Is there an ASP refresh command that...
5
4460
by: Steve | last post by:
Hi, I have a private website for 20 people that is similar to a web email client like hotmail. There are two frames, one on the left with links for "New", "History", "Todays" and a frame on the right with a table for viewing the contents of these messages. The left pane checks back with the server every few seconds to see if any new messages need to be processed and updates count accordingly.
12
10826
by: Tarken | last post by:
Hi, I am trying to do some refactoring of a web site to ensure that it displays in the most web clients possible. One of the pages requires to be redirected to another automatically, for one reason or another. My style is usually to reduce the use of Javascript, as much as possible, as in my experience it often causes compatibility issues. Anyhow, the page currently has: ....
4
3187
by: Andrew Alger | last post by:
ok i have two forms. Customer.aspx and Parent_Searh.aspx. There is a button on Customer.aspx that when executed runs javascript code to open up parent_search as a popup. After the user searches for the parent and finds the proper parent in the datagrid they then click on the accept button in the grid. Then I populate a session variable with the parent ID. I then go back to the main page and have it refresh using: ...
10
9253
by: tasmisr | last post by:
This is an old problem,, but I never had it so bad like this before,, the events are refiring when clicking the Browser refresh button. In the Submit button in my webform, I capture the server side click event and I update session information to track the visibilty of some panels in a wizard type navigation ("Next >>" and "<< Back" buttons).. but the refresh button makes another event firing and takes the whole thing to a Choes.. ...
1
3375
by: ppatel | last post by:
Problem I have a problem with web image button control click event. The click event does not get trigger until it has not been clicked once or page refresh occures(which is fine). When click event fires first time it executes code associate with click event(As I expected). the problem is when you refresh page it fires a click event automatically. I looked around many posts and did not find any topics about this problem. Infact the same...
7
15445
by: Juan Romero | last post by:
Hey guys, please HELP I am going nuts with the datagrid control. I cannot get the damn control to refresh. I am using soap to get information from a web service. I have an XML writer output the file to a folder, and then I read it back into the dataset using the dataset1.readxml. Up to this point, everything works wonderfully. The query executes, the dataset gets populated, and I get the results displayed in the datagrid.
12
6051
by: martin1 | last post by:
All, is there window form refresh property? I try to set up window form refresh per minute. Thanks
0
9855
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10588
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10650
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10295
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7830
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7019
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5682
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3136
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.