Public string StudentName Īfter adding Properties and Data Annotations to this class now let’s add Controller Adding Controllerįor adding Controller Just Right click on Controller Folder inside that select Add and then select Controller like as shown belowĪfter clicking on Controller new dialog will popup with name Add Controller in that mention name as " StudentController" and select template as " Empty MVC Controller" like as shown below Namespace DataAnnotationValidation.Models To perform this validation now let's start with creating a Model with Name Student. For adding Model just Right Click on Model àThen Select Add à inside that select Class.Īfter Clicking on class Add New item dialog will popup with class select and asking for class name here we are going to enter class name as “ Student”Īfter entering class name click on Add button. A Student class is added to our project with some default code that will be like as shown below Creating Model and Applying Validation Attribute to it in that select Basic template and click ok.Īfter creating application our project structure like as shown belowĪfter creating application now lets work with Create Model. From Templates select Visual C# àinside that select Web and then project type select ASP.NET MVC 4 Web Application and here we are giving name as “ DataAnnotationValidation” then finally click on ok buttonĪfter naming it just click on OK. After that a new dialog will popup for selecting template. Let’s First create a Basic asp.net Mvc 4 application with name DataAnnotationValidation for that Open visual studio studio àGo to File àSelect New àSelect Project like as shown belowĪfter that you will see new dialog will pop up for selecting your Template and Project type. ![]() ![]() Now let’s start with creating application Creating Asp.Net MVC Application
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |