473,616 Members | 2,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refresh and Button Click

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
Nov 19 '05 #1
2 2336
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.Redire ct
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


Nov 19 '05 #2
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" <aa@aa.comaa> wrote in message
news:e0******** ******@TK2MSFTN GP12.phx.gbl...
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

Nov 19 '05 #3

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

Similar topics

6
3322
by: laura | last post by:
I'm doing a page which gathers some text in the form of a text box in a <form>. This text is saved to a text file, notices.txt and I want to be able to display the saved text on the page, as soon as they click the SUBMIT button - is this possible? At the moment I have a hyperlink called "back" which, once they have entered the text and they click SUBMIT, the "back" hyperlink will refresh the page and it displays the newly entered text....
10
9236
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
3352
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...
3
4336
by: Steve Wark | last post by:
I have created a ASP.NET application and created two forms within the application (Webform1.aspx & Webform2.aspx). On the first form I have placed a textbox (TextBox1) and a button, which when clicked opens the second form using the window.open(). On the second form I have a textbox (TextBox1) and a button as well. When the second button is clicked it closes the second window with window.close(). What I need to happen is a refresh to...
9
7730
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't remember that I clicked a button before the refresh. Here is what is going on: 1) Page Loads 2) User enters some values, clicks the "Save" button 3) The onClick event handler for the save button saves the data to the database and the page is...
17
3301
by: Jim Little | last post by:
Hello, I'm driving myself crazy either because I'm missing something about ASP.NET, or what I'm trying to do simply can't be done. First, I am not using session variables to track state. My app will ultimately be web-farmed, so I resisted using either session variables. Second, what I'm trying to do is easy. What I'm trying to prevent seems impossible.
3
10022
by: Sameer | last post by:
I have a webpage that has a link button. This link button on click opens up a new page. This is what is happening: 1. Load the web page. 2. Click on the link. 3. Refresh the web-page. Result: The webpage gets refreshed and the link buttons onClick event is fired.
7
15435
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.
4
6720
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. If an ASP.NET page postsback, for example, after a button is clicked, and then I refresh the page (ie, by pressing F5 key), why does the same event occur when I press F5 as it did when I clicked the button? For example - On an ASP.NET webform I click a button which produces a postback and a Button.Click event. After the postback, I press F5 to refresh my webform, which executes Button.Click again. Is there a way to prevent the...
0
8146
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7121
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6097
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
4063
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...
0
4141
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2579
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
1
1759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1445
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.