tailieunhanh - ASP.NET 4 Unleased - p 17

Using the Validation Controls LISTING void btnLogin_Click(Object sender, EventArgs e) { if () = “Log in successful!”; } void btnRegister_Click(Object sender, EventArgs e) { if () = “Registration successful!”; } html { background-color:silver; } .column { float:left; width:300px; margin-left:10px; background-color:white; border:solid 1px black; padding:10px; } Show Validation Groups From the Library of Wow! eBook Overview of the Validation. | 134 CHAPTER 3 Using the Validation Controls LISTING @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD script runat server void btnLogin_Click Object sender EventArgs e if Log in successful void btnRegister_Click Object sender EventArgs e if Registration successful script html xmlns http 1999 xhtml head id Head1 runat server style type text css html background-color silver .column float left width 3O0px margin-left 10px background-color white border solid 1px black padding 10px style title Show Validation Groups title head body form id form1 runat server div class column From the Library of Wow eBook Overview of the Validation Controls 135 fieldset legend Login legend P Please log in to our Website. p asp Label id lblUserName Text User Name AssociatedControlID txtUserName Runat server br asp TextBox id txtUserName Runat server asp RequiredFieldValidator id reqUserName ControlToValidate txtUserName Text Required ValidationGroup LoginGroup Runat server br br asp Label id lblPassword Text Password AssociatedControlID txtPassword Runat server br asp TextBox id txtPassword TextMode Password Runat server asp RequiredFieldValidator id reqPassword ControlToValidate txtPassword Text Required ValidationGroup LoginGroup Runat server br br asp Button id btnLogin Text Login ValidationGroup LoginGroup Runat server OnClick btnLogin_Click 3 From the Library of Wow eBook 136 CHAPTER 3 Using the Validation Controls fieldset asp Label id lblLoginResult Runat server div div class column fieldset legend Register legend P If you do not have a User Name please register at our Website. p asp Label id lblFirstName Text First Name AssociatedControlID txtFirstName Runat server br asp TextBox id txtFirstName Runat server asp RequiredFieldValidator id reqFirstName ControlToValidate txtFirstName Text Required .