dotnet / dotnet/aspnetcore

Permit to validate only selected objects binded with [BindProperty] for use with different forms in a single RazorPage

Open
#37,606 3 comments 0 reactions 0 assignees View on GitHub
area-mvc enhancement feature-razor-pages
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

How is well described in this question https://stackoverflow.com/questions/48516547/how-to-implement-two-forms-with-separate-bindproperties-in-razor-pages would be useful to be able to have different input models with different bindings for each form in a single RazorPage.

Currently `ModelState` property validate all models together, but for each form is desirable that only related model is validated. Otherwise having others unmanaged models will lead to have `ModelState.IsValid == false` for each request asking for validation.

### Is your feature request related to a problem? Please describe.
I'm trying to validate only selected binded models when I execute a query on a RazorPage having different forms and different binded models.

### Describe the solution you'd like
I'd like to have a simple way for validate only selected models, something like `ModelState.IsValid(MyBindedProperty)`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.