button click for a control gets processed on each postback

Posted on 2011-10-06
Last Modified: 2012-08-14
I have a user control with a button on it.

The user control is on a web form.

When I click on the button for the user control, the click event fires.

But then, if I simply refresh the browser page (without clicking that button) the event for the button fires (as if I had clicked it).

How can I prevent this behavior?
Question by:knowlton
    LVL 12

    Accepted Solution

    You cannot prevent that event. but you can check on that event like if the values submitted on the button click is already present in the DB or not.

    Hope it helps.
    LVL 15

    Assisted Solution


    That  the way it is. When you load the page again / refresh it, the entire page cycle gets fired again.You can at the most Popup the alert to the user prompting whether he want's to really refresh again
    with OK CANCEL option.

    LVL 5

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now