In this article we will see how to use ValidationSummary in asp .net. We can use ValidationSummary to show consolidate validate messages of all validators used in the webpage.
Validations are the most important part of websites and software. By using validations we can restrict users to enter any Invalid data into your database. There are many validation techniques available to validate form data like JQUERY validations, server side validations. In Asp .Net microsoft has provided us great validation controls. In this series of articles we will explore validation controls provided by microsoft.
Previous article from the series:
Step1: Create Textbox for name field apply RequiredFieldValidator, Create Age field apply RequiredFieldValidator and CompareValidator to ensure input text is only integer, create email field apply RequireFieldValidator and RegularExpressionValidator validator to ensure only valid emails are entered.
Step2: Use Display="None" property of all Validators. This will hide original error message of Validation controls.
Step3: Use ControlToValidate property of RangeValidator and enter id of TextBox which you want to validate.
Step4: Create Validation summary and Change its ForeColor property to Red.
HTML:
Final Output: