Share via


Exercise 4: Validation

The login UI allows new user accounts to be created. It performs some validation of data. In this final step you will add an additional validation requirement.

  1. Run the application.
  2. Ensure you’re not already logged in and then click the login button.
  3. Instead of logging in, click the Register Now link at the bottom of the dialog.
  4. Try clicking OK without filling in any fields.

    Note:
    Most of the fields will light up red. If you click in them, you will see further details. This behavior is controlled in the RegistrationData.cs(C#) or RegistrationData.vb(VB) file in the Models folder of the SlEventManager.Web project.

    Figure 1

    Registration Validation

  5. Close the browser.
  6. Find the FriendlyName property in the RegistrationData class. (Currently this field is not required.)
  7. Add a [Required](C#) or <Required()>(VB) attribute to this property and run the application again.
  8. Try to register without filling any details in again. This time, the Friendly name field should turn red like the rest.