ASP.NET中 ValidationGroup[控件的属性]:分组验证的使用
ylbtech-ASP.NET-Control-Validator: ValidationGroup[控件的属性]:分组验证的使用 |
ASP.NET中 ValidationGroup[控件的属性]:分组验证的使用。
1.A,运行效果返回顶部 |
ValidationGroup[控件的属性]:分组验证
同组验证的组名相同
登录 | 注册 |
用户名: | 注册账号: |
密 码: | 密 钥: * |
1.B,源代码返回顶部 |
/Demo5.aspx
View Code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Dome5.aspx.cs" Inherits="Dome5" %> <!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> <style type="text/css"> .style1 { width: 333px; } </style> </head> <body> <form id="form1" runat="server"> <div> <h2>ValidationGroup[控件的属性]:分组验证</h2> <hr /> 同组验证的组名相同 <hr /> 踩踩<table style="width:100%;"> <tr> <td>登录</td> <td>注册</td> </tr> <tr> <td class="style1"> 用户名:<asp:TextBox ID="txtUsername" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUsername" ErrorMessage="*" ValidationGroup="a"></asp:RequiredFieldValidator> </td> <td> 注册账号:<asp:TextBox ID="txtRUsername" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtRUsername" ErrorMessage="*" ValidationGroup="r"></asp:RequiredFieldValidator> </td> </tr> <tr> <td class="style1"> 密 码:<asp:TextBox ID="txtUserpass" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtUserpass" ErrorMessage="*" ValidationGroup="a"></asp:RequiredFieldValidator> </td> <td> 密 钥:<asp:TextBox ID="txtRUserpass" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtRUserpass" ErrorMessage="*" ValidationGroup="r"></asp:RequiredFieldValidator> </td> </tr> <tr> <td class="style1"> <asp:Button ID="Button1" runat="server" Text="登录" ValidationGroup="a" /> </td> <td> <asp:Button ID="Button2" runat="server" Text="注册" ValidationGroup="r" /> </td> </tr> </table> </div> </form> </body> </html>
1.C,资源下载返回顶部 |
https://files.cnblogs.com/ylbtech/WebForm-BasicControl-Validator.rar
作者:ylbtech 出处:http://ylbtech.cnblogs.com/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。 |