当前位置:网站首页>ASP using panel to realize simple registration page
ASP using panel to realize simple registration page
2022-06-29 21:58:00 【Eighty eight old】
newly build web forms Panel.aspx
Drag in control Panel It's a container , Controls can be placed in containers 
here aspx Code :( The design is as follows )
```bash
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Panel.aspx.cs" Inherits="Chap2_Panel" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="pnlStep1" runat="server">
First step : enter one user name
<br />
user name :<asp:TextBox ID="txtUser" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnStep1" runat="server" Text=" next step " />
</asp:Panel>
</div>
</form>
</body>
</html>
The same can be , Add a second 、 Three panels
```bash
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Panel.aspx.cs" Inherits="Chap2_Panel" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="pnlStep1" runat="server">
First step : enter one user name
<br />
user name :<asp:TextBox ID="txtUser" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnStep1" runat="server" Text=" next step " />
</asp:Panel>
<asp:Panel ID="pnlStep2" runat="server">
The second step : Enter user information <br /> full name :<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br />
Telephone :<asp:TextBox ID="txtTelephone" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnStep2" runat="server" Text=" next step " />
</asp:Panel>
<asp:Panel ID="pnlStep3" runat="server">
The third step : Please confirm your input information <br />
<asp:Label ID="lb1Msg" runat="server" Text="Label"></asp:Label>
<br />
<asp:Button ID="btnStep3" runat="server" Text=" confirm " />
</asp:Panel>
</div>
</form>
</body>
</html>
Go to background code aspx.cs
Set the page to load for the first time pnlStep1 so
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
pnlStep1.Visible = true;
pnlStep2.Visible = false;// invisible
pnlStep3.Visible = false;
}
}
Double click the first button , Set up events
protected void btnStep1_Click(object sender, EventArgs e)
{
pnlStep1.Visible = false;
pnlStep2.Visible = true;
pnlStep3.Visible = false;
}
Double click the second button , Set up events
protected void btnStep2_Click(object sender, EventArgs e)
{
pnlStep1.Visible = false;
pnlStep2.Visible = false;
pnlStep3.Visible = true;
lb1Msg.Text = " user name :" + txtUser.Text + "<br/> full name :" + txtName.Text + "<br/> Telephone :" + txtTelephone.Text;// Output user information
}
Double click the third button , Set up events
protected void btnStep3_Click(object sender, EventArgs e)
{
// Save user information to the database
}
aspx Complete code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Panel.aspx.cs" Inherits="Chap2_Panel" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="pnlStep1" runat="server">
First step : enter one user name
<br />
user name :<asp:TextBox ID="txtUser" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnStep1" runat="server" Text=" next step " OnClick="btnStep1_Click" />
</asp:Panel>
<asp:Panel ID="pnlStep2" runat="server">
The second step : Enter user information <br /> full name :<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<br />
Telephone :<asp:TextBox ID="txtTelephone" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnStep2" runat="server" Text=" next step " OnClick="btnStep2_Click" />
</asp:Panel>
<asp:Panel ID="pnlStep3" runat="server">
The third step : Please confirm your input information <br />
<asp:Label ID="lb1Msg" runat="server" Text="Label"></asp:Label>
<br />
<asp:Button ID="btnStep3" runat="server" Text=" confirm " OnClick="btnStep3_Click" />
</asp:Panel>
</div>
</form>
</body>
</html>
aspx.cs Complete code
using System;
public partial class Chap2_Panel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
pnlStep1.Visible = true;
pnlStep2.Visible = false;
pnlStep3.Visible = false;
}
}
protected void btnStep1_Click(object sender, EventArgs e)
{
pnlStep1.Visible = false;
pnlStep2.Visible = true;
pnlStep3.Visible = false;
}
protected void btnStep2_Click(object sender, EventArgs e)
{
pnlStep1.Visible = false;
pnlStep2.Visible = false;
pnlStep3.Visible = true;
lb1Msg.Text = " user name :" + txtUser.Text + "<br/> full name :" + txtName.Text + "<br/> Telephone :" + txtTelephone.Text;// Output user information
}
protected void btnStep3_Click(object sender, EventArgs e)
{
// Save user information to the database
}
}

边栏推荐
- Redis (I) -- getting started with redis (1) -- redis introduction, installation and startup, and common configurations
- LeetCode 1. 两数之和
- [advanced ROS chapter] lesson 2 custom header and source file encapsulation
- How to use SMS to deliver service information to customers? The guide is here!
- How to prepare samples for application of color coated steel sealing plates to BS 476-3?
- Golang operation etcd
- 唯品会关键词搜索API接口(item_search-按关键字搜索唯品会商品API接口),唯品会API接口
- Information available from radar echo
- How to integrate MES system with ERP? This article tells you the answer
- Is it safe to open a securities account in Caixue school?
猜你喜欢

2022 openvino DevCon unveils secrets! Intel and many partners deepen the construction of developer ecology and release the innovation potential of AI industry

Layer 3 loop brought by route Summary - solution experiment

How can colleges and universities build future oriented smart campus based on cloud native? Full stack cloud native vs traditional technology architecture

Water polo chart - using dynamic ripples to show percentages

Huawei cloud AOM version 2.0 release

Verilog realizes serial communication and sends it to the nixie tube

yolov6训练自己的数据记录+yolov5对比测试

Viewing technological changes through Huawei Corps (V): smart Park

Recruit | DBA Data Engineer every week with an annual salary of 35+. Dream of Kyushu and bright stars!

Threejs basic introduction
随机推荐
Layer 3 loop brought by route Summary - solution experiment
Is it safe to bind securities accounts to flush? Which securities firm can bind flush after opening an account
Digital password lock Verilog design + simulation + on board verification
The database of the server cannot be connected [the service has been started, the firewall has been closed, the port has been opened, and the netlent port is not connected]
【ROS进阶篇】第四讲 ROS中的重名问题(节点、话题与参数)
Reflections on remote sensing image interpretation
[fishing artifact] code tool for lowering the seconds of UI Library -- form part (I) design
DB queries the database, merges two unrelated tables, adds non-existent fields, and assigns default values
Information available from radar echo
Flutter technology and Practice (2)
ASP动态创建表格 Table
证券开户选择哪个证券另外想问,现在在线开户安全么?
Summary of document level symbols under different systems
Matlab output format control%d,%f,%c,%s usage
How to make good use of data science?
About Effect Size
STM32最小系统搭建(原理图)
How to use the DVD entry level in taro3.*
硅树脂油漆申请美国标准UL 790 Class A 合适吗?
[force deduction 10 days SQL introduction] day7+8 calculation function