Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

New Post: Nullable SelectedID of the DropDownList has always a TRUE ModelState although the ID is Null

$
0
0

The method signature of your Delete method isn't correct - it should be:

 public ActionResult Delete(DeleteReleaseListViewModel model) 

... not 

 public ActionResult Delete(int? selectedId) 

FluentValidation is invoked as part of the model binding process after MVC has copied property values to the destination object. Your validator is defined as an AbstractValidator<DeleteReleaseListViewModel>, but as your action method wasn't taking a DeleteReleaseListViewModel instance, FluentValidation had nothing to do.


Viewing all articles
Browse latest Browse all 1917

Trending Articles