Search results

Form submit to the list box

In the following code snippet, the value that is in selected state will be sent on form submit.

@using Syncfusion.EJ2.Blazor.DropDowns
@using Syncfusion.EJ2.Blazor.Buttons

<form>
    <EjsListBox DataSource="@Data">
        <ListBoxFieldSettings Text="Text" Value="Id" />
    </EjsListBox>
    <EjsButton IsPrimary=true>SUBMIT</EjsButton>
</form>

@code {
    public List<ListData> Data = new List<ListData> {
        new ListData { Text = "Hennessey Venom", Id = "list-01" },
        new ListData { Text = "Bugatti Chiron", Id = "list-02" },
        new ListData { Text = "Bugatti Veyron Super Sport", Id = "list-03" },
        new ListData { Text = "SSC Ultimate Aero", Id = "list-04" },
        new ListData { Text = "Koenigsegg CCR", Id = "list-05" },
        new ListData { Text = "McLaren F1", Id = "list-06" },
        new ListData { Text = "Aston Martin One- 77", Id = "list-07" },
        new ListData { Text = "Jaguar XJ220", Id = "list-08" }
    };
    public class ListData {
      public string Text  { get; set; }
      public string Id  { get; set; }
    }
}

Output will be shown as

ListBox