@using RadzenBlazorDemos.Data
@using RadzenBlazorDemos.Models.Northwind

@inherits DbContextPage

<div class="rz-p-12 rz-text-align-center">
    <RadzenAutoComplete Value=@companyName Change=@OnChange Data=@customers TextProperty="@nameof(Customer.CompanyName)" Style="width: 13rem" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "Company Name" }})" />
    <RadzenText TextStyle="TextStyle.Body2">Start typing e.g. France</RadzenText>
    @if (!string.IsNullOrEmpty(companyName))
    {
        <RadzenText TextStyle="TextStyle.Body2">Value is: <strong>@companyName</strong></RadzenText>
    }
</div>

@code {
    string companyName;

    IEnumerable<Customer> customers;

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();

        customers = dbContext.Customers;
    }

    void OnChange(dynamic args)
    {
        companyName = args;
    }
}