0

I'm finding it really difficult to figure out a way to clear my WebForms page fields when the user decides to click 'back'.

This is causing a few issues with users who are clicking back and then forwards again and as they are clicking back there is no Page_Load method being called, for me to initialise the fields.

This is a rather old project and I don't necessarily want to run a document.ready or something (which I'm also not entirely sure executes when moving back).

Is there any way I can detect a 'back' click in my code and automatically just reset the page?

aspirant_sensei
  • 1,568
  • 1
  • 16
  • 36

1 Answers1

0

Page_Load is not called because page is loaded from browsers cache.

You can disable it using Response.Cache.SetNoStore(); or you could handle pageshow and pagehide events. See: Clear all fields in a form upon going back with browser back button

Gecko
  • 16
  • 1