Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

EditForm requires either a Model parameter, or an EditContext parameter

$
0
0

How does one resolve this Blazor error?

EditForm requires either a Model parameter, or an EditContextparameter

I have created a minimally reproducible example below. The issue seems to be because the model is not instantiated...Why does the following simple page throw this error?

@page "/"<EditForm @Model="@person"><input @bind="@person.FirstName" /><input @bind="@person.LastName" /></EditForm>@code {    public Person person = new Person();    protected override Task OnInitializedAsync()    {        person = new Person        {            FirstName = "Fred",            LastName = "Flintstone"        };        return base.OnInitializedAsync();    }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>