BootstrapTagBoxValues<TKey> Class

Gets required TagBox values (predefined or custom tags) on the controller side and passes these values to the control.

Namespace: DevExpress.AspNetCore.Bootstrap

Assembly: DevExpress.AspNetCore.Bootstrap.v18.1.dll

Declaration

public class BootstrapTagBoxValues<TKey> :
    Object,
    IBootstrapTagBoxValuesOwner
Public Class BootstrapTagBoxValues(Of TKey)
    Inherits Object
    Implements IBootstrapTagBoxValuesOwner

Type Parameters

Name Description
TKey

Type of a tag value's field used in a TagBox control.

Using the BootstrapTagBoxValues<TKey> class only makes sense once custom tags are activated in the Tag Box control. To do this, enable the AllowCustomTags property.

Important

This class requires that the control not use the Loading items on demand feature. Otherwise, obtain tag box values via a List<string>-type model and manually detach predefined tags (which an end-user can select from a Tag Box drop-down list) from custom tags (which are not listed in the Tag Box control but manually entered by an end-user).

The BootstrapTagBoxValues<TKey> class provides you with the following features:

To bind a control to both custom tags and predefined tags, pass a model of the BootstrapTagBoxValues<TKey> type to the Tag Box control. The code below demonstrates this approach in detail.

 @model BootstrapTagBoxValues<int>

<form method="post">
    @(Html.DevExpress()
        .BootstrapTagBoxFor(m => m)
        .AllowCustomTags(true)
        .Items(items =>
        {
            items.Add()
              .Text("Item 1")
              .Value(1);
        }))
    <button type="submit" class="btn btn-primary">Submit</button>
</form>

For more information on the Tag Box control, refer to the Tag Box online demo.

Example

The following example demonstrates how to use the BootstrapTagBoxValues class with a Tag Box that allows custom tags.

BootstrapTagBox for ASP.NET Core - How to use the BootstrapTagBoxValues class

Inheritance

Object
BootstrapTagBoxValues<TKey>

See Also