在线学习系统注册(ASP.NET)

效果显示

 HTML页面显示

 HTML代码

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    </head>
<body>
    <form id="form1" runat="server">
    <div>
    <h3>在线学习系统注册</h3>
        <br />
    <asp:Label ID="Label1" runat="server" Text="用户名:"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:Label ID="Label2" runat="server" Text="密码:"></asp:Label>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

        <br />
        <br />
        <asp:Label ID="Label3" runat="server" Text="性别:"></asp:Label>

        <asp:RadioButtonList ID="RadioButtonList3" RepeatDirection="Horizontal" runat="server">
            <asp:ListItem>男</asp:ListItem>
            <asp:ListItem>女</asp:ListItem>
        </asp:RadioButtonList>
        <br />
        <br />
        <asp:Label ID="Label4" runat="server" Text="所学专业:"></asp:Label>
        <asp:RadioButtonList ID="RadioButtonList1" RepeatDirection="Horizontal" runat="server">
            <asp:ListItem>软件技术</asp:ListItem>
            <asp:ListItem>网络技术</asp:ListItem>
            <asp:ListItem>电子商务</asp:ListItem>
            <asp:ListItem>互联网技术</asp:ListItem>
        </asp:RadioButtonList>
        <br />
        <asp:Label ID="Label5" runat="server" Text="所学语言:"></asp:Label>
        <br />
        <asp:RadioButtonList ID="RadioButtonList2" RepeatDirection="Horizontal" runat="server">
            <asp:ListItem>Java</asp:ListItem>
            <asp:ListItem>Python</asp:ListItem>
            <asp:ListItem>PHP</asp:ListItem>
            <asp:ListItem>C++</asp:ListItem>
        </asp:RadioButtonList>
        <br />
        <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" Text="注册" onclick="Button1_Click" />
&nbsp;&nbsp;&nbsp;
        <asp:Button ID="Button2" runat="server" Text="清除" onclick="Button2_Click" />
        <br />
        <asp:Label ID="Label6" runat="server"></asp:Label>
    </div>
    </form>
</body>
</html>

事件代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label6.Text = "用户名:" + TextBox1.Text + "<br><br>密码:" + TextBox2.Text +
            "<br><br>性别: " + RadioButtonList3.SelectedItem.Text + "<br><br>专业:" + RadioButtonList1.SelectedItem.Text +
            "<br><br>所学语言:" + RadioButtonList2.SelectedItem.Text;
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text = null;
        TextBox2.Text = null;
        RadioButtonList3.Text = null;
        RadioButtonList1.Text = null;
        RadioButtonList2.Text = null;
        Label6.Text = null;
    }
}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

T何必当初

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值