TokenBox

The DevExpress ASP.NET MVC TokenBox editor provides the ability to autocomplete values from a predefined list. An end-user can select a value from the dropdown list or type it manually.

To learn more about TokenBox and see it in action, refer to the TokenBox online demo.

Implementation Details

TokenBox is realized by the TokenBoxExtension class. Its instance can be accessed via the ExtensionsFactory.TokenBox helper method, which is used to add a TokenBox extension to a view. This method's parameter provides access to the TokenBox settings implemented by the TokenBoxSettings class, allowing you to fully customize the extension.

TokenBox's client counterpart is represented by the MVCxClientTokenBox object.

Declaration

TokenBox can be added to a view in the following manner.

View code (Razor):

@Html.DevExpress().TokenBox(settings =>
{
    settings.Name = "tokenBox1";

    settings.Properties.TextField = "Name";
    settings.Properties.ValueField = "Email";

    settings.Properties.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
    settings.Properties.IncrementalFilteringDelay = 500;
}).BindList(Model).GetHtml()
Note

The Partial View should contain only the extension's code.

The image below illustrates the results.

MVC_TokenBox_Overview

See Also