<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Validation Groups Demo</title>
</head>
<body>
<form id="Form1" runat="server">
Username:<br />
<asp:TextBox id="usernameTextBox" runat="server" />
<asp:RequiredFieldValidator id="usernameReq"
runat="server"
ControlToValidate="usernameTextBox"
ErrorMessage="Username is required!"
SetFocusOnError="True"
ValidationGroup="Login" />
Password:<br />
<asp:TextBox id="passwordTextBox"
runat="server"
TextMode="Password" />
<asp:RequiredFieldValidator id="passwordReq"
runat="server"
ControlToValidate="passwordTextBox"
ErrorMessage="Password is required!"
SetFocusOnError="True"
ValidationGroup="Login" />
<asp:Button ID="loginButton"
runat="server"
Text="Log In"
ValidationGroup="Login" />
<h1>Register</h1>
Username:<br />
<asp:TextBox id="newUserNameTextBox" runat="server" />
<asp:RequiredFieldValidator id="newUserNameReq"
runat="server"
ControlToValidate="newUserNameTextBox"
ErrorMessage="Username is required!"
SetFocusOnError="True"
ValidationGroup="Register" />
Password:<br />
<asp:TextBox id="newPasswordTextBox"
runat="server"
TextMode="Password" />
<asp:RequiredFieldValidator id="newPasswordReq"
runat="server"
ControlToValidate="newPasswordTextBox"
ErrorMessage="Password is required!"
SetFocusOnError="True"
ValidationGroup="Register" />
<asp:Button ID="registerButton"
runat="server"
Text="Register"
ValidationGroup="Register" />
</form>
</body>
</html>
|