web form 伺服器控制項表單驗證

來源:互聯網
上載者:User

標籤:erro   dem   doc   表單驗證   register   asp   textbox   button   span   

 1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ValidationDemo.aspx.cs" Inherits="Validation.ValidationDemo" %> 2  3 <!DOCTYPE html> 4  5 <html xmlns="http://www.w3.org/1999/xhtml"> 6 <head runat="server"> 7     <title></title> 8 </head> 9 <body>10     <form id="form1" runat="server">11     <div>12       <table class="auto-style1">13         <tr>14           <td>Name:</td>15           <td>16             <asp:TextBox ID="TextName" runat="server"></asp:TextBox>17             <asp:RequiredFieldValidator ID="RequiredFieldValidator1" 18               runat="server" ControlToValidate="TextName" 19               ErrorMessage="Name required">*</asp:RequiredFieldValidator>20           </td>21         </tr>22         <tr>23           <td>Email:</td>24           <td>25             <asp:TextBox ID="TextEmail" runat="server"></asp:TextBox>26             <asp:RequiredFieldValidator ID="RequiredFieldValidator2" 27               runat="server" ControlToValidate="TextEmail" Display="Dynamic" 28               ErrorMessage="Email required">*</asp:RequiredFieldValidator>29             <asp:RegularExpressionValidator ID="RegularExpressionValidator1" 30               runat="server" ControlToValidate="TextEmail" Display="Dynamic" 31               ErrorMessage="Please enter an email" 32               ValidationExpression="\w+([-+.‘]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>33           </td>34         </tr>35         <tr>36           <td>37             <asp:Button ID="Button1" runat="server" Text="Register" />38           </td>39           <td>&nbsp;</td>40         </tr>41       </table>42 43     </div>44         <asp:ValidationSummary ID="ValidationSummary1" runat="server" />45     </form>46 </body>47 </html>

 

web form 伺服器控制項表單驗證

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.