Validating user input in asp net web pages
So from the users' point of view, it gives him fast response and from the developers' point of view, it saves valuable resources of server.
Java Script is most widely used to perform client side validation.
There could be scenarios when we want the data to be in some range example date input.
So for all the above mentioned scenarios, if we take the user input without validation, then chances are that we will end up having wrong data with us (perhaps in database).
If we want to have this control display the error messages for some particular validation controls (possibly because we have multiple property of the controls.
Let's move ahead and see how validation summary will be useful for us.
If we need to change this to do this validation in server side, then we will have to set the . Now let us say we have a hypothetical scenario where we want the same name to be entered twice (not so hypothetical if it would be password) then we can have a property.
Let's say we have a simple form with name field and we don't want this to be empty.
The we already added will display the full error message.
If we look at the timestamp we added on the page, we can verify that the validation is happening on the client side and no postback is happening to the server.
If we need to change this to do this validation in server side, then we will have to set the .
In scenarios where we want to ensure that the value entered by the user is in some predefined range, we can use this control.
So it is always a good idea to have validation in place whenever we are taking input from the user.