asp。net简单的登录(不完整)

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

<!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>
    <style type="text/css">
        * {
            margin: 0px;
            padding: 0px;
        }

        #div_Boss {
            position: relative;
             100%;
            min- 700px;
            height: 670px;
            background-color: #00c5cd;
        }

        #div_Top {
            position: relative;
             100%;
            height: 150px;
            text-align: center;
        }

        #biaoti {
            position: relative;
            top: 50px;
            font-size: 60px;
            font-family: 微软雅黑;
            color: white;
        }

        #div_Main {
            position: relative;
             100%;
            height: 450px;
        }

        #denglu {
            position: relative;
             450px;
            height: 100%;
            background-color: white;
            margin: 0 auto;
        }

        #div_Bottom {
            position: relative;
             100%;
            height: 50px;
            text-align: center;
        }

        #diandi {
            position: relative;
            top: 30px;
            font-size: 15px;
            font-family: 微软雅黑;
            color: white;
        }

        #dl1 {
            position: relative;
             100%;
            height: 25%;
            text-align: center;
        }

            #dl1 span {
                position: relative;
                top: 30px;
                font-size: 45px;
                font-family: 微软雅黑;
                color: DarkOrange;
            }

        #dl2 {
            position: relative;
             100%;
            height: 50%;
        }
        #dl2_1 {
            position:relative;
            margin-left:80px;
            top:50px;
            100%;
            height:200px;
        }
            #dl2_1 span {
                font-size:18px;
                font-family:微软雅黑;
            }
            #dl2_1 input {
                200px;
                height:20px;
                background-color:#e0e0e0;
            }

        #dl3 {
            position: relative;
             100%;
            height: 25%;
            text-align: center;
        }

        #Button1 {
            position: relative;
            top: 30px;
             300px;
            height: 50px;
            font-size: 20px;
            font-family: 微软雅黑;
            background-color: DarkOrange;
            color: white;
            border: 0px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div id="div_Boss">
            <div id="div_Top">
                <span id="biaoti">起航高科技软件系统</span>
            </div>
            <div id="div_Main">
                <div id="denglu">
                    <div id="dl1">
                        <span>用户登录</span>
                    </div>
                    <div id="dl2">
                        <div id="dl2_1">
                            <span>用户名:</span><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:Label ID="Label1" runat="server" Text=""></asp:Label><br />
                            <br />
                            <span>密&nbsp;&nbsp;&nbsp;码:</span><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                        </div>
                    </div>
                    <div id="dl3">
                        <asp:Button ID="Button1" runat="server" Text="登    陆" OnClick="Button1_Click" />
                    </div>
                </div>
            </div>
            <div id="div_Bottom">
                <span id="diandi">起航科技 版权所有 凑字数凑字数凑字数凑字数凑字数凑字数</span>
            </div>
        </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 Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = "用户名错误";
    }
}

Label - 文本显示控件,虽然说属性中可以设置此控件的诸多样式,但是不建议大家使用,而是使用CSS来设置相应的样式

Literal - 用来显示文本,text中的内容会原封不动的打印到浏览器中,不会生成其它的代码

TextBox - TextMode,ReadOnly,MaxLength,AutoPostBack

Button - 按钮 - onClientClick - 要执行的JS代码,比后台代码优先执行

LinkButton - 超链接模样的按钮

ImageButton - 图片模样的按钮

原文地址:https://www.cnblogs.com/zhangdemin/p/5681678.html