Preventing duplicate postback processing when refreshing with update panels

uzangn36

New Member
basically what I am trying to achieve is this (asp.net 4) :
  • If a user does a postback on an ImageButton or similar control it should cause a page Post, and go through the entire asp life cycle.
  • If this has just happened, and the user presses F5 or similar to refresh, it should ignore all events from the previous post and just do a regular Get.
  • If the user clicks Save multiple times it should register only 1 Post and not cause duplicates being created etc.
  • If there are update panels on the page, a Post should only update the panels data, whereas a Get(refresh) should reload the entire page.
I have had a look around and am currently using the Response.Redirect method (once processing is completed in a post it does a response redirect to the same page to replace the Post with a Get). This is unsatisfactory for a number of reasons
  • It causes unnecessary overhead doing two page Posts every save
  • I would like to have regions of the page in Update Panels, and at the moment if you change something and save it in one region, it reloads the entire page.
I found this similar SO question here which highlights a few methods, none of which looks like they will solve my needs. I also found this which is an interesting method, but I was wondering if anyone could tell me if it will solve all my above needs before I try implement it? Also, is the onsubmit event firing the only difference between a Post or a refresh mimicking a Post?Regarding the 3rd bullet above, I have read about the jQuery .one() function, but I am looking for an application wide solution, as most of the app has been developed without this in mind.Thanks in advance!
 
Back
Top