Appendix: Using the DATA Element Tag

The DATA element renders the value found at a specific path in a local JSON object.

Implementation:

  1. Click to open the Element Browser to the right of the window.
  2. Use the Filter menu to select Tags.
  3. Locate and select DATA.

The element has the following syntax:

<%# DATA(
Keyword
Path
[other parameters as required]) %>

Parameters can be entered in any order. Where a parameter is not required, it should be excluded.

The following parameters are required:

Parameter Description
Keyword The keyword of the intended JSON object.
Path The path of the intended value. This parameter is case-sensitive.

The following parameters are optional:

Parameter Description
Default A message string that will appear instead of a value if the specified path does not exist. This string must consist of at least one character, so if you want a blank space to appear, make sure you place a space between the string's quotes.
Type The expected data type of the value returned. This should be one of the following: "Boolean", "Currency", "Date", "DateTime", "Number", "String", or "Time". The default value is "String".
Format A C# string formatting pattern to apply to the value returned. For example, use "C" to render an integer as currency.
IsAsync A Boolean value that determines whether the operation is asynchronous. The default value is True.
AsyncRendering A message string that will appear to users while data is being rendered. Only applicable if IsAsync is True.
AsyncMethod The name of a JQuery method to call when the operation is complete. Only applicable if IsAsync is True. The default value is RenderData.

An example of a complete Data tag is as follows, which will display the value of user.name in the data assigned to the UserDetails keyword:

<%# DATA(
Keyword="UserDetails"
Path="user.name" ) %>