Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp button and history back onclientclick

hi I have an asp button which is created using the following code:

<asp:Button ID="btnBack" OnClientClick='javascript:history.back()' runat="server" Text="back">
</asp:Button>

However, now the javascript doesn't work to go a history back. On the other hand, if I make an alert() it works...why. Why is it not working to go a history back?

like image 444
Marc Avatar asked Dec 17 '09 14:12

Marc


1 Answers

Try with return false at end:

 <asp:button id="btnBack" runat="server" text="Back" 
OnClientClick="JavaScript: window.history.back(1); return false;"></asp:button>
like image 56
TStamper Avatar answered Oct 25 '22 18:10

TStamper