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

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
End Sub
<form runat="server">
Enter your name: <asp:textbox id="name" runat="server" /><br>
<asp:button text="Next Page" runat="server" OnClick="Do_page1" />

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
End Sub
<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>

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-2023  |  Page Processed at 2023-10-03 10:52:25 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search