www.webdeveloper.com
Results 1 to 2 of 2

Thread: Redirect to another page after update

  1. #1
    Join Date
    Dec 2005
    Posts
    7

    Redirect to another page after update

    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:

    HTML Code:
    <asp:ImageButton ID="ImageButton4" Runat="server" CommandName="Insert" SkinID="save" />
    And when I add postbackurl it does not save to the database.
    HTML Code:
    <asp:ImageButton ID="ImageButton4" Runat="server" CommandName="Insert" SkinID="save" PostBackUrl="~/Guestbooks.aspx" />
    What am I doing wrong?
    Thanks
    Shannon

  2. #2
    Join Date
    Apr 2005
    Posts
    634
    are u using visual studio.net? if so, double click your imagebutton and vs.net will generate you a method lookes like this:

    Code:
    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:

    Code:
    Response.redirect("guesstbooks.aspx");

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles