Reputation: 5002
I am working on an ASP.NET application which has the following Back button on all the pages in application.
<input type="button" id="btnBack" onclick="history.back();" value = "<- Back" />
There is a particular Test.aspx page in which this is not working most of the time. Test.aspx page only has a dropdownlist with autopostback
set to true.
When I change the value in the dropdownlist to some value, say from the default value value1
to value2
, and if I then click on the btnBack
, it doesn't work most of the times. When it doesn't work, I see that the browser's back button is disabled.
The interesting this is that this occurs only on Test.aspx page.
I read this question: IE8 Back Button Stops Working on ASP .NET Page. but it did not help much unfortunately.
Edit: I also set Page.SmartNavigation = true;
in the code-behind to prevent the postback from being added to browser history, but it did not help as well.
Upvotes: 1
Views: 737
Reputation: 66649
When it doesn't work, I see that the browser's back button is disabled.
This is the main clue that this call is not work, because this function actually call the same function as this button. If there is no previous page for any reason, then can not go back.
Upvotes: 1