Previous(Unwanted) event handled when page refreshed by key F5
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 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 behavior occured for regular web button control click event too.
Let say you have webproject and page name is WebForm1
Drop one textbox control and one imagebox control on webpage form
Double click on Imagebox control.
It will create following event
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
//Code for saving a record
Set break point on private void ImageButton1_Click
Test1: Hit page refresh button on IE
Result: nothing will happen ( I mean private void ImageButton1_Click will not trigger)
Test2: type some text in textboxes and click image button.
Result: private void ImageButton1_Click will trigger and it will Save that record.
Hit Debug->Continue again
Test3: do not do any thing after Test2. Just hit page refresh button on IE
Result: private void ImageButton1_Click will trigger. And that record get saved again.
Why ? I want to have private void ImageButton1_Click occure only when Imagebutton click occurs not on page refresh.
Thanx and Regards,
Posted by a user from .NET 247 (http://www.dotnet247.com/)
|All times are GMT. The time now is 04:30 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.