Computer Magic Logo
Textstring

Sunday, June 7, 2015

Published by Aristotelis Pitaridis

Textstring is an input control that allows the administrator to enter one line text. Below we can see an example of creating a property of type Textstring:

The My Textstring property has the following appearance when we edit the document:

In order to read the value as a strongly typed object we use the following code:

@{
    if (Model.Content.HasValue("mytextstring"))
    {
        <p>@(Model.Content.GetPropertyValue<string>("mytextstring"))</p>
    }
}

In order to read the value using dynamic properties we use the following code:

@{
    if (CurrentPage.HasValue("mytextstring"))
    {
        <p>@CurrentPage.mytextstring</p>
    }
}