Search code examples
c#sitecoresitecore6sitecore7

Why does sitecore ignores default value 0 by type integer?


I'm using sitecore. For a project I have created a template with a simple type integer field. This integer field has default value of 0.

When I create a new item based on this template the value 0 (default value), it is not displayed. By changing the default value to 1 (for example) it is displayed. Is there anyone who knows how to fix this issue?

Thanks a lot.

Jordy


Solution

  • Sitecore does NOT ignore default value 0. The value '0' IS stored in Sitecore for Integer field it's just not displayed by this field as this is a default value for int type (or maybe long cause from what I know the value is parsed to long).

    If you change to show Raw values the value will be displayed.

    And if you access this field value from the code, you will get 0.