example7.aspx

来自「东软内部材料(四)asp等相关的教学案例 」· ASPX 代码 · 共 46 行

ASPX
46
字号
<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" Language="C#" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<mobile:Form runat="server" id="first">
   Enter name:
   <mobile:TextBox runat="server" id="name"/>
   Enter password:
   <mobile:TextBox runat="server" id="password" Password="true"/>
   Confirm password:
   <mobile:TextBox runat="server" id="confirm" Password="true"/>
   <mobile:Command runat="server" id="enter" Onclick="enter_click"
                   Text="Enter"/>
   <mobile:RequiredFieldValidator runat="server" ControlToValidate="name"
                                  ErrorMessage="Please enter a name" />
   <mobile:RequiredFieldValidator runat="server"
                                  ControlToValidate="password"
                                  ErrorMessage="Please enter a password" />
   <mobile:RequiredFieldValidator runat="server" ControlToValidate="confirm"
                              ErrorMessage="Please confirm your password" />
   <mobile:CompareValidator runat="server" ControlToValidate="confirm"
                            ControlToCompare="password"
                          ErrorMessage="Confirmation must match password" />
</mobile:Form>

<mobile:Form runat="server" id="second">
   <mobile:ValidationSummary runat="server" formToValidate="first"
                             HeaderText="Invalid input"/>
</mobile:Form>

<mobile:Form runat="server" id="third">
   <mobile:Label runat="server">Input accepted.</mobile:Label>
</mobile:Form>

<script runat="server">

public void enter_click(Object sender, System.EventArgs e)
{
   if (Page.IsValid)
      ActiveForm = third;
   else
      ActiveForm = second;
   
}

</script>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?