Tag Archives: Validation

ASP.NET Core MVC Ajax Form requests using jquery-unobtrusive

This article shows how to send Ajax requests in an ASP.NET Core MVC application using jquery-unobtrusive. This can be tricky to setup, for example when using a list of data items with forms using the onchange Javascript event, or the oninput event. Code: https://github.com/damienbod/AspNetCoreBootstrap4Validation Setting up the Project The project uses the npm package.json file, […]

ASP.NET Core Action Arguments Validation using an ActionFilter

This article shows how to use an ActionFilter to validate the model from a HTTP POST request in an ASP.NET Core MVC application. Code: https://github.com/damienbod/AngularAutoSaveCommands 2018-11-22: Updated to Angular 7.1.0, nuget packages 2018-09-28: Updated to ASP.NET Core 2.1.4 and Angular 6.1.9 2018-06-16: Updated to ASP.NET Core 2.1 and Angular 6.0.5 2018-02-11: Updated to ASP.NET Core […]

Turning off validation for properties in a MVC model

Sometimes it is required that some properties in a MVC model should not be validated, but the rest are required and should be validated in the client view. Mostly I cannot turn off client validation for all properties in the model. Here is an example of a Model class. I need to validate 2 properties […]

Validation in MVC, Enterprise Library, Fluent Validation, Data Annotations, FoolProof

MVC Validation MVC has many possibilities for validation. Depending on the use case, the correct validation should be used. Here is a list of MVC validation possibilities: Server side Model-level validation Server side Property-level validation Client side Model-level validation Server side Property-level validation Server side custom validation When validating, a number of problems can exist […]

Simple MVC Application using FluentValidation.MVC4

This is a simple example of MVC application using FluentValidation.MVC4. http://fluentvalidation.codeplex.com/ Create a new web application MVC4. Get the fluent validation using nuget: Create a validation rule set class: Now add the attribute to the model class: FluentDataModel Add the Provider to the Global.asax file App_Start() method And the validation works (Note: the dependency validation […]

Simple MVC Application using standard Validation (DataAnnotations)

This is a simple example of standard MVC validation provided in the .NET framework. Create a new MVC application. Edit the index.cshtml file. Important: for client validation to work, the scripts section must be included. (Defined per default in the _Layout View and the BundleConfig.cs in the App_Start folder) Create a Model Edit the web.config […]

Enterprise Library 6, Unity 3, MVC, Validation with Interception ValidationCallHandler Part 5

This post continues on from the previous post. Part 4 Enterprise Library 6, Unity 3 InterfaceInterceptor with MVC 4 In this post a validation call handler will be added using unity 3 with VirtualMethodInterceptor and enteprise library Policy Injection. Enterprise library 6 has the following call handlers (Out of the box): AuthorizationCallHandler ExceptionCallHandler LogCallHandler PerformanceCounterCallHandler […]