User2041008840 posted
How Can I bind the dropdownlist in Blazor Server, It showing Error Object Refrence not set to an instant object.
Please help Me
<select class="form-control selectpicker" @bind="Employee.CountryID">
<option>--select--</option>
@foreach(var item in Countries)
{
<option>@item.Name</option>
}
</select>
Country[] Countries;
public Employee Employee { get; set; }
Employee[] employees;
//Department[] Departments;
protected override async Task OnInitializedAsync()
{
Employee = new Employee();
await load();
}
protected async Task load()
{
Countries = await CountriesService.GetCountryAsync();
employees = await EmployeesService.GetEmployeesAsync();
}