This article discusses how to validate information you get from users — that is, to make sure that users enter valid information in HTML forms in an ASP. What you'll learn: If you ask users to enter information in a page — for example, into a form — it's important to make sure that the values that they enter are valid.
For example, you don't want to process a form that's missing critical information.
when the page is validated the content of the UC should also be validated.
The examples you seen so far are all based on one page.
The following example shows a page that illustrates these steps. code-cshtml Main] To see how validation works, run this page and deliberately make mistakes.
For example, here's what the page looks like if you forget to enter a course name, if you enter an, and if you enter an invalid date: By default, user input is validated after users submit the page — that is, the validation is performed in server code.
Firstly we made 1 variable above the If Statement named msg.
Then we have if (Is Post), which simply means on form submit process the data.