当前位置:网站首页>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
}
}

边栏推荐
- Amazon Keyword Search API interface (item_search- Amazon product search interface by keyword), Amazon API interface
- ASP利用Panel实现简易注册页面
- 这次跟大家聊聊技术,也聊聊人生
- Design of VHDL telephone billing system
- Win10 add SSH public key
- Résumé du projet de petite bibliothèque
- Digital password lock Verilog design + simulation + on board verification
- As a developer, you need to know about the codeless development platform IVX
- yolov6训练自己的数据记录+yolov5对比测试
- Final training simple address book c language
猜你喜欢

PostgreSQL weekly news - June 22

ASP.NET 跨页面提交(Button控件页面重定向)

A new Polaris has risen!

Golang operation NSQ distributed message queue

Win10添加ssh公钥
![[cloud native] use of Nacos taskmanager task management](/img/ad/24bdd4572ef9990238913cb7cd16f8.png)
[cloud native] use of Nacos taskmanager task management

Structure the fifth operation of the actual camp module

Summary of document level symbols under different systems

Bs-gx-018 student examination system based on SSM

随机推荐
Getting started with completabilefuture
Matlab output format control%d,%f,%c,%s usage
C. Most Similar Words
Reading notes on how to connect the network - Web server request and response (V)
Realization of graduation project topic selection system based on JSP
Amazon Keyword Search API interface (item_search- Amazon product search interface by keyword), Amazon API interface
Shell implementation of Memcache cache cache hit rate monitoring script
Layer 3 loop brought by route Summary - solution experiment
[cloud native] use of Nacos taskmanager task management
Aleph farms hired a supervisor of regulatory affairs to prepare for global commercialization in advance
阿里巴巴商品详情API接口(item_get-获得商品详情接口),阿里巴巴API接口
Design of VHDL telephone billing system
Summary of document level symbols under different systems
American tunneling ASTM E84 surface flame retardant test
I want to register my stock account online. How do I do it? In addition, is it safe to open a mobile account?
C. Where‘s the Bishop?
leetcode:724. Find the central subscript of the array
Golang operation NSQ distributed message queue
Implementation and Simulation of ads131a04 ADC Verilog