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

Method 2 - Panels

2) Panels

ASP.NET also introduced panels, these panels are like different areas of the page and you can turn the on and off, or add controls to them. When making multi-page forms you can use panels to show different pages of the form, although it is still on the same page.

<script language="VB" runat="server">
Sub page_load(sender as object, e as EventArgs)

End Sub

Sub Do_page1(sender as object, e as EventArgs)
page1.Visible = false
page2.Visible = true
End Sub
Sub Do_Page2(sender as object, e as EventArgs)
page2.Visible = false
page3.Visible = true
End Sub
</script>
<form runat="server">
<asp:panel runat="Server" id="page1">
Enter your name: <asp:textbox id="name" runat="server" /><br>
<asp:button text="Next Page" runat="server" OnClick="Do_page1" />
</asp:panel>
<asp:panel runat="server" id="page2" visible="false">
What city do you live in? <asp:textbox id="city" runat="server" /><br>
<asp:button text="Finish" runat="server" OnClick="Do_page2" />
</asp:panel>
<asp:panel runat="server" id="page3" visible="false" >
Thank you for completing the form!
</asp:panel>
</form>

Live Demo

See the Visible=False is set on the other pages and is changed on the Click event handlers. If your wondering what happens to the form values when they're submitted then just check the Viewstate on the last page, it's all there.


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-19 7:56:17 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search