Validations in ASP .NET Core
HTML-код
- Опубликовано: 10 сен 2024
- Previous Part
• .Net5 CRUD using Multi...
Image Bank Project
• File and Image Upload ...
Inventory Project Playlist
• Asp net core 5 MVC Tut...
Types of Validations in Asp.Net Core.
There are three types of Validation methods exists in not only in Asp .NET core but in all Web Based software. Irrespective to the languages
used to develop that Software.
They are
Client Side validations, Server Side Validations and Remote Validations.
1. Client Side validations.
Client side validation is the process to validate the form
to ensure all required form controls are filled out, in the required and correct format.
This mainly checks the data formats.
normally this is done by JavaScript.
we are doing this from before the coming of ASP .NET Core
and we are doing it in ASP .NET core also. This will get continued until web based software exists.
But the method of doing client side validations in asp.net core
has changed a lot. In here, we can automate this by using the data annotations class. we have already seen many examples on this in my previous tutorials.
2. Server Side Validations.
Server side validations, we do at server side.
I mean at the controller or in the repository.
Even though all fields of the forms are already validated
at the client side. there exists lot of possibilities to cheat the client side validations by turning off the JavaScript on the browser.
so on Such scenarios, The program saves the not validated data to the persistent store like database. which is high risk for any software.
So to overcome those problems. we use Server side validations.
Server side validations are very important because, it will ensure that
the data passed to the database are valid. and does not break the
data rules and integrity of the database.
3. Remote Validations.
What is remote validation?
Remote validation is the process where we validate specific data
by posting only that data to a server without
posting the entire form data to the server.
This normally we do using partial post or AJAX.
It is very useful on checking for the duplicates.
for example,
During a user registration
process. it would be very nice if we
show the error message to the user in advance
that the entered userid is Already Taken.
instead of redirecting him to the error page
after submitting the form.
This is a very interesting video. so watch and enjoy.
Happy coding.
by the way don't forget to Like & Share.
Do Subscribe and press the bell icon for More Videos.
Thank You
-Aniz
Excellent work dear friend ,thanks for nice sharing , we learn lot of new things from ur channel . waiting for new videos .
Sir, Can you Demo CRUD asp.net core using modal popup with AJAX and don’t use HTML helper?
Sure, will do.
Hello sir, thank you for all the videos. Can you make a video about efcore relationships (one-to-one, one-to-many...). And how can we implement relationships in models & best practices for loading the related data (eager loading,lazy loading).
You are Most Welcome. Sure I will.
Hi, please share link for solution creation for this project. Did you follow any design patterns
You can follow from this source code ruclips.net/video/ZXynHdk35fU/видео.html
Image Not Shown in Image Tag ======> onchange="document.getElementById('PreviewPhoto').src = window.URL.createObjectURL(this.File[0])">
Onchange Method is Not Working