Data Binding

Data Binding

IWML supports both one way and two way data binding to objects, including data obtained and updated by REST.

Syntax

To bind any IWML property use the syntax:

=<source type>.<source name>.<field names>(parameters):<format>

For example, this binds a property to a data value in a dataset:

=data.Users.username

Source Type

Source type specifies a specific handler to handle the data binding. Each source type has its own requirements as to which parts are optional or not.

Source Name

Optional, although many source types require it. Meaning of source name depends on source type.

Field Names

Optional and depends on the source type.

Parameters

Optional and depends on the source type.

Format

<format> is always optional and can also be used with any source type. If not specified, the : is not necessary. Formatters can be used to transform or format the data values.

Formatters are independent of other fields and work on the result provided by the source type.

In Markdown

Data binding can exist in markdown using the data tag. Any bindings in markdown are one way and read only as markdown has no input.

Properties

If the target of the binding is an IntraWeb property (Atozed.Props.Property<>) then .Value can be used, or omitted and it will be defaults.

For example, these two are identical:

=page.Slider.Max.Value
=page.Slider.Max

Data Source Types

To bind to data, first a source of the data must be chosen, aka a data source. Currently IWML supports the following data sources.

Data source types are not case sensitive. this, THIS, and This are all the same. Field names however are usually case sensitive.

Special Values

These are not true data binding expressions, but are treated as such to avoid requiring an additional special notation.

==Text

The leading = is what signifies that the property is to be data bound. If the property is a text value and = is actually needs to be displayed rather than data bound, use == instead and only one = will be displayed. For example:

==This is raw text that starts with a single = and is not data bound.