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

Why is my bind-Value not working it always returns null

$
0
0

i have a problem with my @bind-Value is always coming up NULL

@page "/database"<PageTitle>Database</PageTitle><div class="row"><div class="col-12"><div class="card"><div class="card-body"><h1 class="card-title text-center">DataBase Insert</h1><br /><br /><EditForm Model="@employee" method="post" OnValidSubmit="AddNewEmployee" FormName="registerMaster"><div class="form-floating mb-3"><InputText @bind-Value="employee.Name" class="form-control" placeholder="Name" /><label for="Name">Name</label></div>                    <div class="form-floating mb-3"><InputNumber @bind-Value="employee.Age" class="form-control" placeholder="Age" /><label for="Age">Age</label></div><div class="form-floating mb-3"><InputText value="employee.Title" class="form-control" placeholder="Title" /><label for="Title">Title</label></div>                    <div class="form-floating mb-3"><InputText @bind-Value="employee.Gender" class="form-control" placeholder="Gender" /><label for="Gender">Gender</label></div><button type="submit" class="btn btn-primary btn-rounded">Submit</button></EditForm></div></div></div></div>@inject Data.AppDbContext DbContext@code{    public Employee employee = new Employee();    public async Task AddNewEmployee()    {        DbContext.Employees.Add(employee);        await DbContext.SaveChangesAsync();    }}

I tried @bind-value="" that just straight give me a error to use @bind-Value can someone explain what am i missing


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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