J.J.Baxter - My place on the web - interests, hobbies, thoughts & ruminations
Home / Blog
Books
Links
Images
Aug Sep-2010 Oct
SMTWTFS
2930311234
567891011
12131415161718
19202122232425
262728293012
3 4 5 6 7 8 9
Reset Calendar
Snorg Girls
Programming Tips
Sherlock Holmes
Mythbusters
Gallipoli
Nova Science Now
Ajax Loading Images
The Girls of Dr. Who
Keratosis Pilaris (KP)
Amazing Water
Buy me a drink? I'll have a Cappuccino, thanks.
Random Images
Random Link
Scott Adams Blog
Random Book
Catcher in the Rye
by JD Salinger






All Rights Reserved 2008
JJBaxter.com

J.J.Baxters Development Tips & Snippets
backBack
 ASP.Net Back button without clearing form fields (ASP.NET : 19-Aug-2007)
I need to back to a data input page without clearing the original values.
I new I could do this with standard html like this:

<input type="button" value=" Cancel " onClick="javascript:history.go(-1)">

so in asp.net I reasoned this would work

<asp:button id="BackButton" runat="server" width="190px" height="60px" text=" Return To Input Page " CausesValidation="false" />

with

BackButton.Attributes.Add("onclick","history.go(-1);");

In the PageLoad event would do the trick. However it just refreshed the current page. After trying many variations I found the linked page that provided the answer. The trick is to add return false; to the onlick attribute.

BackButton.Attributes.Add("onclick","history.back(); return false;");

Ref Link: http://www.thescripts.com/forum/thread286847.html