Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How to issue "back" command from ASP.NET on the server

Posted on 2012-09-14
Medium Priority
Last Modified: 2012-09-17
I have a web application written in classic ASP that  uses the following to return to a form if errors were found on it:

<a href="javascript:history.back(-1)">

This app is being modified to call an ASP.NET page to do some processing and display a report using Crystal Reports. If the user presses "Cancel" on the report I want to return to the previous page with the form data loaded.
Question by:dyarosh
LVL 26

Accepted Solution

Alan Warren earned 2000 total points
ID: 38401008
You can trigger javascript from an asp event by adding an attribute to the sending control.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Button2.Attributes.Add("onClick", "javascript:history.back(); return false;")
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
End Sub

Open in new window

To capture/trap a crystal reports cancel print event isn't as straight forward:
Detect Cancel From Crystal Report PrintSetup Dialogbox, but it is apparently doable.


Author Closing Comment

ID: 38405115
Thanks.  That gives me something to work with.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Loops Section Overview
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question