Computer Magic Logo
Numeric

Sunday, June 7, 2015

Published by Aristotelis Pitaridis

Integer is an input control of type number which allows the administrator to enter numeric values. Below we can see an example of creating a Numeric property:

The My Numeric 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("myNumeric"))
    {
        <p>@(Model.Content.GetPropertyValue<int32>("myNumeric"))</p>
    }
}

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

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