Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Page Redirect

Page Redirect

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptcomhelptutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Matt Newman
    wrote on last edited by
    #1

    I want my web form to redirect to a different url when a user hits submit on a data entry form. I was wondering if anyone could give me an idea on how to do this. I would like to do it with C# if possible, so in other words I want to avoid javascript since I am doing it with code behind. Thanks if you can help. Matt Newman

    T G 2 Replies Last reply
    0
    • M Matt Newman

      I want my web form to redirect to a different url when a user hits submit on a data entry form. I was wondering if anyone could give me an idea on how to do this. I would like to do it with C# if possible, so in other words I want to avoid javascript since I am doing it with code behind. Thanks if you can help. Matt Newman

      T Offline
      T Offline
      taibo
      wrote on last edited by
      #2

      Hi, Use the Redirect method of HttpResponse object In C# Response.Redirect("http://www.codeproject.com"); Pankaj

      M 1 Reply Last reply
      0
      • M Matt Newman

        I want my web form to redirect to a different url when a user hits submit on a data entry form. I was wondering if anyone could give me an idea on how to do this. I would like to do it with C# if possible, so in other words I want to avoid javascript since I am doing it with code behind. Thanks if you can help. Matt Newman

        G Offline
        G Offline
        Gerald Leslie Jones
        wrote on last edited by
        #3

        If I understand your question correctly.......... 1) Use a Web controls command button and add Click event to it. Inside the event handler write, Response.Redirect("SecondPage.aspx"); where the SecondPage.aspx will be the page to which you want to redirect. 2) If you are using the submit button, remove the action tag from the form element. In the page load event handler write, If(IsPostback) Response.Redirect("SecondPage.aspx"); If you dont want to do anything else than redirecting the page, I hope you can use image button instead of command buttons for efficiency. But I hope you should be doing some "saving data" Process and trying to redirect to other page.

        M 1 Reply Last reply
        0
        • T taibo

          Hi, Use the Redirect method of HttpResponse object In C# Response.Redirect("http://www.codeproject.com"); Pankaj

          M Offline
          M Offline
          Matt Newman
          wrote on last edited by
          #4

          Thanks, that was exactly what I needed Matt Newman

          1 Reply Last reply
          0
          • G Gerald Leslie Jones

            If I understand your question correctly.......... 1) Use a Web controls command button and add Click event to it. Inside the event handler write, Response.Redirect("SecondPage.aspx"); where the SecondPage.aspx will be the page to which you want to redirect. 2) If you are using the submit button, remove the action tag from the form element. In the page load event handler write, If(IsPostback) Response.Redirect("SecondPage.aspx"); If you dont want to do anything else than redirecting the page, I hope you can use image button instead of command buttons for efficiency. But I hope you should be doing some "saving data" Process and trying to redirect to other page.

            M Offline
            M Offline
            Matt Newman
            wrote on last edited by
            #5

            Leslu wrote: 1) Use a Web controls command button and add Click event to it. Inside the event handler write, Response.Redirect("SecondPage.aspx"); where the SecondPage.aspx will be the page to which you want to redirect. Thats it, thanks! Matt Newman

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups