473,394 Members | 1,641 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,394 software developers and data experts.

Page Refresh - Last Event getting handled ...

HI.

I have come across posts from people that had this problem, but none of them were easy to implement.
The best solution was to implement it via a DB .. but I don't wanna go that route.

The problem is when a page containing form data is refreshed, it fires the last handled event.

I am thinking I should have an HiddenField on the Page and have a OnClientClick function for each control that has Events being handled, and once the button is clicked, the value of the hf gets initialised to the name of the control that was clicked or text_changed.

Then in each event handling function, I check that the ClientID of the
[object sender] is equal to the value of the hf, if not, it exists the function ...

Does that sound like a reasonable solution,

Anybody with a simper solution, please please ... let me know.

Thanks ...
Sep 4 '08 #1
1 1434
Frinavale
9,735 Expert Mod 8TB
HI.

I have come across posts from people that had this problem, but none of them were easy to implement.
The best solution was to implement it via a DB .. but I don't wanna go that route.

The problem is when a page containing form data is refreshed, it fires the last handled event.

I am thinking I should have an HiddenField on the Page and have a OnClientClick function for each control that has Events being handled, and once the button is clicked, the value of the hf gets initialised to the name of the control that was clicked or text_changed.

Then in each event handling function, I check that the ClientID of the
[object sender] is equal to the value of the hf, if not, it exists the function ...

Does that sound like a reasonable solution,

Anybody with a simper solution, please please ... let me know.

Thanks ...
Your solution sounds fine.

When the user hits the refresh button they are shown a prompt stating that they are about to execute the last command so they should already understand that this behaviour is going on.

If you don't want your code to be executed more than once, consider disabling the button after they click it...which will be re-enabled upon page postback.

-Frinny
Sep 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Stan | last post by:
If a page has a button with event handler private void btnAdd_Click(object sender, System.EventArgs e) { ....... } this event handler fires every time I refresh the page in the browser with...
5
by: Dan | last post by:
We have a simple site. It's a frameset with two frames a left and a right. The left frame is essentially a list of records from a database (using a server-side repeater control). When you click...
0
by: sanjay patil via .NET 247 | last post by:
Hello, I have a problem with web image button control click event. I am saving a record to database on click event of this image button. When click event fires first time it executes code...
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...
5
by: Peter Rilling | last post by:
I have an interesting issues that, although I not blocking me, is not very performance. Maybe someone can suggest a better way of doing this. 1) I have a page that displays a grid with command...
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:...
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...
4
by: Dan | last post by:
Hi, i'm not sure to understand the difference between refreshing the pagina by clicking on 'refresh' in the browser and a postback. What i think it is: Suppose a page with a form containing a...
3
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
I want to have following hotkey used in asp.net application, how to do this especially for F5? ESC F3 F4 F5 F6 F9 F10
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
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...

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.