This topic is locked

Redirect to the LIST page after ADDing or EDITing

10/5/2005 12:18:09 PM
ASPRunnerPro General questions
R
razvan author

I'd like to be redirected to the main LIST page after adding or editing a record rather than being sent back to the Add/Edit page with the confirmation message that the record has been modified or added...

Thanks!

Sergey Kornilov admin 10/6/2005

Here is how you can do this. See my changes in bold.
Edit page

response.redirect "table_name_here_list.asp?message=Record updated"

message="<div class=message><<< " & "Record updated" & " >>></div>"


Add page

response.redirect "table_name_here_list.asp?message=Record was added"

message="<div class=message><<< " & "Record was added" & " >>></div>"


List page

call WriteTableHeader

   

if Request(message)<>"" then

  response.write "<div class=message><<< " & Request(message) & " >>></div>"

end if

call loopRs(rs, CLng(PageSize))

A
ashumak 2/9/2006

IS this done in the template editor? Do I need to add to all three?
Alan

Sergey Kornilov admin 2/9/2006

Yes, you need to use Template Editor and you need to apply all three.
If you use ASPRunnerPro 4.0 you can use Events to achieve the same more elegant way.

Use redirect to another page sample action after record is added or updated.

Use ListOnLoad Event to display a message.

A
ashumak 2/10/2006

Tried it (using 4)...
It added:
Sub AfterEdit()

'** Redirect to another page ****

Response.Redirect Teleleads_list.asp
End Sub
But nothing is different!?!
Alan

Sergey Kornilov admin 2/12/2006

Alan,
you forgot double quotes around page name:

Response.Redirect "Teleleads_list.asp"
A
ashumak 2/13/2006

"Got it"
Now working!
Thanks,
Alan

C
ccurnutt 2/21/2006

This does not work for me! (I must be an idiot!)
Using 4.0 build 79
I've tried all three (Add / Copy / Delete) events to redirect.
My code looks like...(Add Table Event, after record added)
Sub AfterAdd()

'** Redirect to another page ****

Reponse.Redirect "showmaster_list.asp"
End Sub
What am I doing wrong?

Sergey Kornilov admin 2/21/2006

Syntax error here that was fixed in later build. Should be the following:

Sub AfterAdd()

'********** Redirect to another page ************

Response.Redirect "showmaster_list.asp"
End Sub
A
ashumak 2/23/2006

Got it working, however, afetr editing a record, it goes back to the basic list, not the list as shown before the edit. Any work around for this?
Alan

Sergey Kornilov admin 2/24/2006

Alan,
please see my changes

Response.Redirect "showmaster_list.asp?action=backtolist"