Click to See Complete Forum and Search --> : Redirect to another page after update


odamsr
03-22-2006, 10:26 PM
I am building a guest book. I have two forms - guestbook.aspx (enters the guestbook info) and guestbooks.aspx (lists all of the comments). When a user selects to add a comment I want it to add the comment to the database and then get redirected to guestbooks.aspx. I have it saving and everything is working fine except once it saves to the database it is not redirecting. I have the following:

<asp:ImageButton ID="ImageButton4" Runat="server" CommandName="Insert" SkinID="save" />

And when I add postbackurl it does not save to the database.
<asp:ImageButton ID="ImageButton4" Runat="server" CommandName="Insert" SkinID="save" PostBackUrl="~/Guestbooks.aspx" />

What am I doing wrong?
Thanks
Shannon

sirpelidor
03-23-2006, 03:52 PM
are u using visual studio.net? if so, double click your imagebutton and vs.net will generate you a method lookes like this:


private void ImageButton4_Click(object sender, System.EventArgs e)


this method implies the things are going to happen when that button is pressed.
so now..you just need to do a response.redirect to your new form:


Response.redirect("guesstbooks.aspx");