-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support model binding to Razor Pages properties on page and PageModel classes #5952
Comments
Would we bind properties on the page and the model or just the model if both are available? |
It would be based on the presence of an attribute (let's start with |
Nope. The model wins if it's present. Ok, seems straightforward, find properties with |
Yep, let's start there and we'll tweak after use if necessary. |
@DamianEdwards \ @rynowak - what's the behavior for model binding in GET requests? Right now I have it enabled. However if you have models with validation, the ModelState is invalid at that point. I had to do things like: @if (Context.Request.Method == "POST")
{
@Html.ValidationSummary()
} to avoid seeing validation errors on my first GET. |
Spoke to @DamianEdwards and @rynowak offline and we decided to not model bind properties on GET requests. |
No description provided.
The text was updated successfully, but these errors were encountered: