Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Avoid calling events when page is refreshed

Avoid calling events when page is refreshed

Scheduled Pinned Locked Moved ASP.NET
questiondatabase
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dpriya
    wrote on last edited by
    #1

    Hi, I want to avoid the events being called when page is refreshed. For eg: I call a button event that modifies some data in the database. If i press F5 on the same page again the button event is fired and data is modified. How do I avoid it? Thanks in advance Priya

    M 1 Reply Last reply
    0
    • D Dpriya

      Hi, I want to avoid the events being called when page is refreshed. For eg: I call a button event that modifies some data in the database. If i press F5 on the same page again the button event is fired and data is modified. How do I avoid it? Thanks in advance Priya

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Hi Priya. What you're describing is a side-effect in most browsers when reloading a page that was the result of a POST operation. I'm not aware of anything you can do server-side to prevent this. But there are some things you can do to work around it. For example, if the POST inserts data in a database, you could include code that checks to see if the insert has already taken place (check for example if a record already exists with all the parameters). I think CodeProject does something like this to prevent double posting of the same forum messages. You can Google to find more workarounds. Here are a couple of threads where some other ideas are presented: http://forums.asp.net/1180000/ShowPost.aspx[^] http://forums.asp.net/2/776500/ShowPost.aspx#776500[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups