Closed
Description
For razor pages, when one modifies a bound model property in an OnPost
method on a page with a asp-for="MyProperty"
property, the new value is shown for input
controls, but not for textarea
controls. For textarea
, when the page is rendered, it stays the same as the AttemptedValue
.
To be clear:
<input asp-for="MyProperty">
shows the new value when it is updated in OnPost
, but <textarea asp-for="MyProperty"></textarea>
does not.
I would expect that the behavior (whether asp-for
is bidirectional) should be consistent across input types, like input
, textarea
, select
, etc.
Workaround:
public void OnPost() {
// MyProperty = "Something"; // Updating this way does not work for `textarea`, but does for `input`
// But this does:
ModelState["MyProperty"].AttemptedValue = "My new value"`
}
Same as this issue, but this is for Razor Pages:
Metadata
Metadata
Assignees
Labels
No labels