aspnet-devexpress-dot-web-7f60dede.md
The token box editor.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public class ASPxTokenBox :
ASPxAutoCompleteBoxBase,
IControlDesigner
Public Class ASPxTokenBox
Inherits ASPxAutoCompleteBoxBase
Implements IControlDesigner
The ASPxTokenBox editor provides the capability to auto complete tokens from a predefined list.
The ASPxTokenBox control is available on the DX.25.2: Common Controls toolbox tab in the Microsoft Visual Studio IDE.
Drag the control onto a form and customize the control’s settings, or paste the control’s markup in the page’s source code.
<dx:ASPxTokenBox ID="tokenBox" runat="server" DataSourceID="AddressBookXml" TextField="Name" ValueField="Email" />
<asp:XmlDataSource ID="AddressBookXml" runat="server" DataFile="~/App_Data/Contacts.xml" XPath="//Contacts/*" TransformFile="Contacts.xsl" />
using DevExpress.Web;
...
protected void Page_Load(object sender, EventArgs e)
{
ASPxTokenBox tokenBox = new ASPxTokenBox();
tokenBox.ID = "tokenBox";
Page.Form.Controls.Add(tokenBox);
tokenBox.DataSourceID = "AddressBookXml";
tokenBox.TextField = "Name";
tokenBox.ValueField = "Email";
tokenBox.DataBind();
}
Imports DevExpress.Web
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim tokenBox As ASPxTokenBox = New ASPxTokenBox()
tokenBox.ID = "tokenBox"
Page.Form.Controls.Add(tokenBox)
tokenBox.DataSourceID = "AddressBookXml"
tokenBox.TextField = "Name"
tokenBox.ValueField = "Email"
tokenBox.DataBind()
End Sub
Note
DevExpress controls require that you register special modules, handlers, and options in the Web.config file. You can change this file or switch to the Design tab in the Microsoft Visual Studio IDE to automatically update the Web.config file. Note that this information is automatically registered if you use the DevExpress Template Gallery to create a project.
The ASPxTokenBox offers the following features:
When the ASPxEditor gets focus, the drop-down window can be displayed on the ASPxTokenBox.ShowDropDownOnFocus property. The drop-down displays items that are contained in the ASPxAutoCompleteBoxBase.Items collection. The collection can be populated manually or by binding to a data source. End-users can select items from the drop-down window or type them manually. If the ASPxTokenBox.AllowCustomTokens property is set to true, end-users can type custom tokens, i.e., tokens that have no corresponding items in the ASPxAutoCompleteBoxBase.Items collection.
The editor items can be filtered if it is allowed by the ASPxAutoCompleteBoxBase.IncrementalFilteringMode property.
The collection of tokens is accessible by the ASPxTokenBox.Tokens property. Note that tokens in the collection must be unique, so adding a token with text which is already contained in the collection does nothing.
Note
The ItemValueType property values should be equal to the item’s value type (string, by default).
Starting with v19.1.4, add a custom token to the item collection before you add this item to the Tokens collection.
Show 17 items
Show 18 items
Object Control WebControl ASPxWebControlBase ASPxWebControl ASPxDataWebControlBase ASPxDataWebControl ASPxEditBase ASPxEdit ASPxTextEdit ASPxPureTextBoxBase ASPxTextBoxBase ASPxButtonEditBase ASPxDropDownEditBase ASPxAutoCompleteBoxBase ASPxTokenBox BootstrapTagBox
See Also
Online Demo: Token Box - Features