0

I'm trying out aspnetboilerplate and I love it so far. I downloaded the template with just ASP.NET Core MVC. The one thing I don't quite understand is when I have a Model class i.e.

public class CreateSubjektInput
{
    [StringLength(11), Required]
    public string Oib { get; set; }
}

When there is a Model error (e.g. stringlength = 5) I get an AbpValidationException without even hitting the controller. So how to do client side validation like in aspnet core with jquery.unobtrusive? Or how to handle model errors? I read the documentation and I saw in sample projects the validation was in pure javascript. I'm lost here

Jones
  • 375
  • 1
  • 4
  • 14

1 Answers1

-1

First, read this document:

https://aspnetboilerplate.com/Pages/Documents/Validating-Data-Transfer-Objects

There are lot of different methods to doing this in ABP. Custom validation attributes, overriding existing modelState, jquery.unobtrusive, and etc.

Big part of validation code is here:

https://github.com/aspnetboilerplate/aspnetboilerplate/tree/dev/src/Abp/Runtime/Validation

AliRıza Adıyahşi
  • 15,658
  • 24
  • 115
  • 197