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

Method 5 - Context

5) Using the Context object

(06/23/02)

This idea was submitted to me by Kirk Jackson, Thanks!

The context object is a variable that is initalized at the start of each request and will last until the end of the request. You can store items in this object and then transfer the page using Server.Transfer.

Page 1 -

<script language="VB" runat="server">
Sub Do_page1(sender as object, e as EventArgs)
Context.Items("Name") = name.Text
Server.Transfer("mpf9.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>

This would store it and sent it along.

Last Page

Thanks <%=Context.Items("Name")%>, I hope it's nice in <%=Context.Items("City")%>.

Summary

Well, you have learnt the ways to work-around that annoying 'Always-post-back' problem in ASP.NET


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





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


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-16 4:15:27 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search