In my .Net MVC4 project the view contains partialviews, the partialviews replaced on another after each corresponding Ajax.Beginform
with option InsertionMode = InsertionMode.Replace,
So the senario is
- Partialview1 renders on first
Ajax.Beginform
call - Submit form, partialview2 render on 2nd
Ajax.beginform
, so partialview1 is replaced by partialview2
3. A previous button recalls partialview1
Im wondering how to implement step3 that goes to previous partialview with something simple as history back.
First Way: I think the best way to do that with browser Back button is to use
history.pushState
How to implement it depends on your situation on
View
.Some links about
pushState
:http://rosspenman.com/pushstate-jquery/
https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history
Second Way: If you don't want to use browsers Back buttom you can use js:
and in your Html: