KeudellCoding.Blazor.AdvancedBlazorSelect2 1.0.0

There is a newer version of this package available.
See the version list below for details.
Install-Package KeudellCoding.Blazor.AdvancedBlazorSelect2 -Version 1.0.0
dotnet add package KeudellCoding.Blazor.AdvancedBlazorSelect2 --version 1.0.0
<PackageReference Include="KeudellCoding.Blazor.AdvancedBlazorSelect2" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KeudellCoding.Blazor.AdvancedBlazorSelect2 --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: KeudellCoding.Blazor.AdvancedBlazorSelect2, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install KeudellCoding.Blazor.AdvancedBlazorSelect2 as a Cake Addin
#addin nuget:?package=KeudellCoding.Blazor.AdvancedBlazorSelect2&version=1.0.0

// Install KeudellCoding.Blazor.AdvancedBlazorSelect2 as a Cake Tool
#tool nuget:?package=KeudellCoding.Blazor.AdvancedBlazorSelect2&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.



Add the following lines to _Host.cshtml (in the head tag)

<script src="_content/KeudellCoding.Blazor.AdvancedBlazorSelect2/Select2JsInterop.js" type="text/javascript" language="javascript"></script>
<script src="_content/KeudellCoding.Blazor.AdvancedBlazorSelect2/lib/select2/js/select2.full.min.js" type="text/javascript" language="javascript"></script>
<link href="_content/KeudellCoding.Blazor.AdvancedBlazorSelect2/lib/select2/css/select2.min.css" rel="stylesheet" />

Add the following lines to _Imports.razor

@using KeudellCoding.Blazor.AdvancedBlazorSelect2

Usage Example

@page "/"
@inject IMemoryCache __MemoryCache
@inject ApplicationDbContext __DbContext

<Select2 TItem="ExampleItemForm"
         IdSelector="c => c.Id.ToString()"
         TextSelector="c => c.Text"
         GetElementById="async (items, id, token) => await items.SingleOrDefaultAsync(i => i.Id.Equals(id), token)"
         Multiselect="false" />

@code {
    public class ExampleItemForm {
        public Guid Id { get; set; }
        public string Text { get; set; }

        public ExampleItemForm(Guid id, string text) {
            Id = id;
            Text = text;


    public List<ExampleItemForm> SelectedItems { get; set; }


    private async Task<List<ExampleItemForm>> filterFunction(IQueryable<ExampleItemForm> allItems, string filter, CancellationToken token) {
        return await allItems.Where(i => i.Text.StartsWith(filter)).ToListAsync();


  1. It is ensured that the SelectedItems list contains only one item if Multiselect is set to false.
  2. As soon as SelectedItems is edited manually, StateHasChanged(); should be executed.
  3. Datasource must contain a list of the type IQueryable. Static lists can also be used, but these must be converted with the addition .AsQueryable();.
  4. GetElementById must be set manually, because in case of a database connection functions in LINQ are not supported.
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 2,578 9/4/2020
1.2.0 217 9/3/2020
1.1.0 212 9/1/2020
1.0.0 221 8/31/2020