Part 12- Server Side and Client Side Validation in ASP.NET MVC

Technotips Ashish
Technotips Ashish
63.2 هزار بار بازدید - 8 سال پیش - Hello everyone, Here in this
Hello everyone, Here in this video I have just explained that how can you apply server side and Client side validation in Asp.net MVC.


SOCIAL :

Like TechnoTips official Page : Facebook: technotipstutorial
Subscribe : aapkanigam

GET CODE here:
http://technotipstutorial.blogspot.in...

INTRODUCTION :

First thing is that why do we use validation?
Suppose the user does not enter any thing and submit the form then definitely the null value will be saved in our database or it will give an exception due to not nullable foreign key .

Apply a server side validation is very simple .
Just go to your view model and write [Required] then right click on it and resolve it .Resolve means your actually adding reference to the data annotation library.

The for displaying message ,go to your page and use Html.ValidationMessageFor() helper

Final step is  to create the overload method of index because if we submit form from index then it should come back to same page with invalid model.

Applying Client side validation is also simple .You just need to add three  references to your page
1. Jquery
2. Jquery unrobustive js
3. Jquery validator plug js

Now you r done with client side validation

RECOMMENDATION :

I strongly suggest you to  watch these videos in order to consolidate your knowledge .

Watch  MODEL VIEW ,CONTROLLER  and DATABASE Connection Video :

1. MODEL : Part 4- Part 4- MODEL Binding in ASP.NET MVC ...
2. VIEW  :Part 3- Part 3- VIEW in ASP.NET MVC (Model-Vi...
3. CONTROLLER  :Part 2- Part 2- CONTROLLER in Asp.net MVC | R...
4.Database connection : Part 6 :Part 6- ASP.NET MVC  Database Connect...

TAGS :
how to create a - website
asp. net mvc
asp.net mvc interview questions
asp .net mvc tutorial
asp. net mvc 4
asp.net mvc 5 tutorial
asp net mvc developer
asp net mvc continuous integration
asp net mvc hosting
model view controller
jquery-ajax
$ ajax jquery
jquery ajax tutorial
viewbag
$controller
$model
razor view engine
$how to get rich
8 سال پیش در تاریخ 1395/09/03 منتشر شده است.
63,284 بـار بازدید شده
... بیشتر