Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

int property: Default value becomes 0 in text box although I set default values to null

Fixed in

EPiServer.CMS.UI 11.4.7

(Or a related package)

Created

May 18, 2018

Updated

Jun 01, 2018

Area

CMS UI

State

Closed, Fixed and tested


Description

Steps to reproduce

  1. Set a default value to null in page/block model.

     [Display(GroupName = SystemTabNames.Content)]
            [Range(0,10)]
            public virtual int? NetworkCatalogDepth { get; set; }
     
            public override void SetDefaultValues(ContentType contentType)
            {
                base.SetDefaultValues(contentType);
                NetworkCatalogDepth = null;
            }
    

  2. Create a new block with this property from a Content Area.

Expected:
The text box is empty, like when I create a new block from the Assets pane.

Actual:
The default value in the text box becomes 0 for an int property.