Skip to main content
All docs
V23.2

HtmlContentControl.DataContext Property

Gets or sets the control’s data context (a business object or data source item).

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DefaultValue(null)]
[DXCategory("Data")]
public object DataContext { get; set; }

Property Value

Type Default Description
Object null

The data context.

Remarks

The DataContext property allows you to bind the control to a data context (a business object or data source item).

HtmlContentControl Data Context

Use the following syntax to display a value of a specific field from the bound data context: ${FieldName}

For example, the following code displays a value of the “UserName” field from the data context.

<div class='contactName'>${UserName}</div>

The ‘$’ character at the beginning of the “${UserName}” expression specifies that the text that follows is an interpolated string—an expression that the control needs to evaluate. An interpolated string can contain static text, data binding to multiple fields, and field value formatting (see string interpolation for more information). The following example adds the ‘Welcome’ string before a user name:

<h1>$Welcome {UserName}!</h1>
See Also