Previous(Unwanted) event handled when page refreshed by key F5

Discussion in 'ASP .Net' started by sanjay patil via .NET 247, Apr 27, 2004.

  1. 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 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.

    Any ideas...



    Test Example:
    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,
    Sanjay.

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>IEqZ/wynWkC9M+JRZKsPcw==</Id>
     
    sanjay patil via .NET 247, Apr 27, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sherif ElMetainy

    EndRequest Event is not handled

    Sherif ElMetainy, Aug 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    799
    Sherif ElMetainy
    Aug 30, 2003
  2. Arjen
    Replies:
    3
    Views:
    69,204
    JackMcKenzie
    Nov 1, 2007
  3. jobs
    Replies:
    0
    Views:
    1,511
  4. Kuldeep
    Replies:
    1
    Views:
    896
    Mark Rae
    May 29, 2007
  5. Stefan Mueller

    Event wanted after page is refreshed

    Stefan Mueller, Dec 26, 2009, in forum: Javascript
    Replies:
    38
    Views:
    281
    Garrett Smith
    Jan 19, 2010
Loading...

Share This Page