Multi-Page Forms
page 4 of 6
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 29508/ 103

Method 3 - Session Variables

3) Session Variables

When the user submits the form you can store the values in session variables and then load them up on the next page.

<script language="VB" runat="server">
Sub Do_page1(sender as object, e as EventArgs)
Session.Contents("name") = name.Text
Response.Redirect("mpf3.aspx")
End Sub
</script>
<form runat="server">
Enter your name: <asp:textbox id="name" runat="server" /><br>
<asp:button text="Next Page" runat="server" OnClick="Do_page1" />
</form>

Page 1 -Live Demo

<script language="VB" runat="server">
Sub page_load(sender as object, e as EventArgs)
Dim name = Session.Contents("name")
End Sub

Sub Do_page2(sender as object, e as EventArgs)
Session.Contents("city") = city.Text
Response.Redirect("mpf4.aspx")
End Sub
</script>
<form runat="server">
What city do you live in <%=name%>? <asp:textbox id="city" runat="server" /><br>
<asp:button text="Next Page" runat="server" OnClick="Do_page2" /><p>
</form>

Page 2 -Live Demo

Thanks <%=Session.Contents("name")%>, I hope it's nice in <%=Session.Contents("city")%>.

Page 3 -Live Demo


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-11-12 1:07:00 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search