Implement ReturnUrl when calling form from multiple places.

I had a situation where I had to call the same record form from multiple grid pages and I wanted to return to the calling page.  To accomplish this I implemented a ReturnUrl similar to how the security works when you are redirected to the Login page and then returned to the calling page.

In the edit and add links on the grid page I added a Link Parameter:

Source Type: Expression

Parameter Source: “session_list.aspx”

Parameter Name: ReturnUrl

Then in the After Initialize event of my record page I added the following code (Session is the name of my record form):

  If Not String.IsNullOrEmpty(Request.QueryString("ReturnUrl")) Then
   Session.RedirectUrl.Address = Request.QueryString("ReturnUrl")
  End If

Then for each of the form buttons (Add, Submit, Delete & Cancel) I add ReturnUrl to the Remove Parameters property.


Leave a Reply

Your email address will not be published. Required fields are marked *