Skip to main content
All docs
V24.2

RepositoryItemTokenEdit.ProcessNewValue Event

Fires when a user enters a new value into a Token Edit that is connected to a data source. Allows you to validate entered values and call data source API to save valid records.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

[DXCategory("Events")]
public event EventHandler<TokenEditProcessNewValueEventArgs> ProcessNewValue

Event Data

The ProcessNewValue event's data class is DevExpress.XtraEditors.TokenEditProcessNewValueEventArgs.

Remarks

The DataSource property allows you to connect the editor to an external data source. Additionally, you need to set up two properties:

At design time, use the control’s smart tag menu to set up all three properties.

Data-bound properties of TokenEdit at design time

Tokens retrieved from a data source are not stored in the RepositoryItemTokenEdit.Tokens collection – this collection is always empty for a data-aware Token Edit.

If a data-aware Token Edit operates in “Manual” mode (see the EditMode property), users who type new values into the editor text box trigger the ProcessNewValue event. This event is similar to the ValidateToken event that raises for unbound Token Edit controls under same circumstances. It allows you to inspect the entered text (the e.Text property) and, if this text is valid, post it to a data source.

//a regular expression to validate entered values
Regex MyRegex = ...;

void TokenEdit1_ProcessNewValue(object sender, TokenEditProcessNewValueEventArgs e) {
    if (MyRegex.IsMatch(e.Text)) {
        //use data source API to post changes
        e.Handled = true;
    }
}

For more information on Token Edit, see the following help topic: Token Edit Control.

See Also