Computer Magic Logo
True / False

Sunday, June 7, 2015

Published by Aristotelis Pitaridis

True/False is a checkbox type input control which allows the administrator to import true/false values. Below we can see an example of creating a True/False property:

The My True False 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("myTrueFalse"))
    {
        <p>@(Model.Content.GetPropertyValue<bool>("myTrueFalse"))</p>
    }
}

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

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