473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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 2326
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


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**************@TK2MSFTNGP12.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
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...
10
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...
1
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...
3
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...
9
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...
17
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...
3
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:...
7
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
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
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,...
0
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...

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.