File tree Expand file tree Collapse file tree 4 files changed +29
-12
lines changed
10/umbraco-cms/fundamentals/design
13/umbraco-cms/fundamentals/design
14/umbraco-cms/fundamentals/design
15/umbraco-cms/fundamentals/design Expand file tree Collapse file tree 4 files changed +29
-12
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,21 @@ Each property in your [Document Type](../data/defining-content/#what-is-a-docume
1919
2020### Specifying types of data
2121
22- You can specify the type of data being returned to help you format the value for display, consider the publish date in our example:
22+ You can specify the type of data being returned to help you format the value for display.
2323
24- To use the ` <IHtmlContent> ` as the data return type, add the ` @using Microsoft.AspNetCore.Html; ` directive.
24+ In our example, we have a string, a date and some rich text:
2525
2626``` html
2727<h1 >@(Model.Value<string >("pageTitle"))</h1 >
28- <div >@(Model.Value<IHtmlContent >("bodyContent"))</div >
28+ <div >@(Model.Value<IHtmlEncodedString >("bodyContent"))</div >
2929<p >Article date: <time >@(Model.Value<DateTime >("articleDate").ToString("dd/MM/yyyy"))</time ></p >
3030```
3131
32+ {% hint style="info" %}
33+ To use ` IHtmlEncodedString ` as the typed value, add the ` @using Umbraco.Cms.Core.Strings; ` directive.
34+ {% endhint %}
35+
36+
3237### Using ModelsBuilder
3338
3439``` html
Original file line number Diff line number Diff line change @@ -14,16 +14,20 @@ Each property in your [Document Type](../data/defining-content/#what-is-a-docume
1414
1515### Specifying types of data
1616
17- You can specify the type of data being returned to help you format the value for display, consider the publish date in our example:
17+ You can specify the type of data being returned to help you format the value for display.
1818
19- To use the ` <IHtmlContent> ` as the data return type, add the ` @using Microsoft.AspNetCore.Html; ` directive.
19+ In our example, we have a string, a date and some rich text:
2020
2121``` html
2222<h1 >@(Model.Value<string >("pageTitle"))</h1 >
23- <div >@(Model.Value<IHtmlContent >("bodyContent"))</div >
23+ <div >@(Model.Value<IHtmlEncodedString >("bodyContent"))</div >
2424<p >Article date: <time >@(Model.Value<DateTime >("articleDate").ToString("dd/MM/yyyy"))</time ></p >
2525```
2626
27+ {% hint style="info" %}
28+ To use ` IHtmlEncodedString ` as the typed value, add the ` @using Umbraco.Cms.Core.Strings; ` directive.
29+ {% endhint %}
30+
2731### Using ModelsBuilder
2832
2933``` html
Original file line number Diff line number Diff line change @@ -14,16 +14,20 @@ Each property in your [Document Type](../data/defining-content/#what-is-a-docume
1414
1515### Specifying types of data
1616
17- You can specify the type of data being returned to help you format the value for display, consider the publish date in our example:
17+ You can specify the type of data being returned to help you format the value for display.
1818
19- To use the ` <IHtmlContent> ` as the data return type, add the ` @using Microsoft.AspNetCore.Html; ` directive.
19+ In our example, we have a string, a date and some rich text:
2020
2121``` html
2222<h1 >@(Model.Value<string >("pageTitle"))</h1 >
23- <div >@(Model.Value<IHtmlContent >("bodyContent"))</div >
23+ <div >@(Model.Value<IHtmlEncodedString >("bodyContent"))</div >
2424<p >Article date: <time >@(Model.Value<DateTime >("articleDate").ToString("dd/MM/yyyy"))</time ></p >
2525```
2626
27+ {% hint style="info" %}
28+ To use ` IHtmlEncodedString ` as the typed value, add the ` @using Umbraco.Cms.Core.Strings; ` directive.
29+ {% endhint %}
30+
2731### Using ModelsBuilder
2832
2933``` html
Original file line number Diff line number Diff line change @@ -14,16 +14,20 @@ Each property in your [Document Type](../data/defining-content/#what-is-a-docume
1414
1515### Specifying types of data
1616
17- You can specify the type of data being returned to help you format the value for display, consider the publish date in our example:
17+ You can specify the type of data being returned to help you format the value for display.
1818
19- To use the ` <IHtmlContent> ` as the data return type, add the ` @using Microsoft.AspNetCore.Html; ` directive.
19+ In our example, we have a string, a date and some rich text:
2020
2121``` html
2222<h1 >@(Model.Value<string >("pageTitle"))</h1 >
23- <div >@(Model.Value<IHtmlContent >("bodyContent"))</div >
23+ <div >@(Model.Value<IHtmlEncodedString >("bodyContent"))</div >
2424<p >Article date: <time >@(Model.Value<DateTime >("articleDate").ToString("dd/MM/yyyy"))</time ></p >
2525```
2626
27+ {% hint style="info" %}
28+ To use ` IHtmlEncodedString ` as the typed value, add the ` @using Umbraco.Cms.Core.Strings; ` directive.
29+ {% endhint %}
30+
2731### Using ModelsBuilder
2832
2933``` html
You can’t perform that action at this time.
0 commit comments