Since ASP.Net forms submit to themselves by default, many people have asked how to get the form results passed on to another page. There is more than one way to do this. One pretty much entails not putting the ‘runat=”server”‘ designation in the form tag, building it just like it was in Classic ASP. However, the main focus of this tutorial is showing you how to accomplish this using the Server.Transfer method.
Server.Transfer actually transfers the user to a new page, but there is one down side to this, in some people’s eyes. The fact that you are on another page may not be readily known by the end-user. The TITLE of the page changes, but the address bar of the receiving page remains the same as the first page.
So here’s the full code of what we need on the first page: Yes, Server.Transfer DOES technically work by itself because it moves the browser to the next page, but it takes a little extra work to be able to take all the form results with it when the system gets to the next page. Everything starts with the form, naturally. Here’s a sample form for the scenario.
<Form id="form1" runat="server"> First Name: <asp:TextBox id="txtFirst" runat="server" /><br> Last Name: <asp:TextBox id="txtLast" runat="server" /> <asp:Button id="button1" Text="Submit" onclick="doSubmit" runat="server" /> </Form>
Continues…