博客
关于我
asp.net4.5练习~test4-2
阅读量:300 次
发布时间:2019-03-03

本文共 1444 字,大约阅读时间需要 4 分钟。

 webform1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="test4_2.WebForm1" %><!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:TextBox ID="txtName" runat="server" AutoPostBack="True" OnTextChanged="txtName_TextChanged"></asp:TextBox>       <asp:Label ID="lblValidate" runat="server"></asp:Label><br />        密码:<asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox><br />        E-mail:<asp:TextBox ID="txtMail" runat="server" TextMode="Email"></asp:TextBox><br />        <asp:Button ID="btnSubmit" runat="server" Text="确认" />    </div>    </form></body></html>

 webform1.aspx.cs

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace test4_2{    public partial class WebForm1 : System.Web.UI.Page    {        protected void Page_Load(object sender, EventArgs e)        {            txtName.Focus();        }        protected void txtName_TextChanged(object sender, EventArgs e)        {            if (txtName.Text == "admin")            {                lblValidate.Text = "此用户已存在";            }            else            {                lblValidate.Text = "用户名可用";            }        }    }}

 

转载地址:http://gurm.baihongyu.com/

你可能感兴趣的文章
(Java基础类库 )System类
查看>>
context:include-filter与exclude-filte控制扫描组件
查看>>
Two Day今日程序学习记录->关于指针的一点问题以及16进制转10进制
查看>>
《Java---------java环境搭建》
查看>>
【SSL】1203书的复制(normal)
查看>>
【SSL】1072砝码称重
查看>>
【SSL】2294打包
查看>>
标程_高精度运算
查看>>
【SSL】1033&【洛谷】P1040加分二叉树
查看>>
js数据结构--队列--常见操作
查看>>
JS数据结构--单向链表--常见操作
查看>>
【SSL】1606&【洛谷】P2014选课
查看>>
JS数据结构--双向链表--常见操作
查看>>
【SSL】1230&【洛谷】P2016战略游戏
查看>>
洛谷P1377树的序
查看>>
高阶函数-语法糖-lambda(三分钟读懂)
查看>>
vue的computed单向绑定(如淘宝的购物车中使用)
查看>>
vue双向绑定
查看>>
vue写自定义指令(全局或者组件内部)
查看>>
vue监听用户点击区域
查看>>