Local Block properties do not show when first creating a block

Vote:
 

Im using latest version of Episerver and have found that when I create a new block from within the Content Area the Local Block properties do not show. 

Anyone else having this issue ? 

#210703
Edited, Dec 03, 2019 16:56
Vote:
 

Are you facing this in fresh installation or in existing project?

Which version of Episerver you are using?

Are these properties are custom properties?

#210705
Dec 03, 2019 17:52
Vote:
 
  • Fresh Install 
  • 11.13.2
  • Local Block contains 
    • Content Reference [UiHint(UiHint.Image)] (Its also Required and Culture Specific - What bugs me out is I can publish the page even though its Required)  
    • String 
  • 2nd Local Block contains 
    • Content Reference 
    • String
  • Parent Block contains 
    • Local Block (Propertes do not show when first creating from within Content Area)  
    • String
    • String
    • Local Block (Propertes do not show when first creating from within Content Area)
    • String

I am also setting Default values 

        public override void SetDefaultValues(ContentType contentType)
        {
            base.SetDefaultValues(contentType);

            Image = new ImageBlock();
            CallToAction = new CallToActionButtonBlock();
        }

I have used this approach many a time before but first time I am seeing the properties not showing 

#210707
Dec 03, 2019 18:10
Vote:
 

Did you try this in incognito mode of browser or by clearing the browser cache.

And one more thing try removing default value code and then try once.

#210708
Dec 03, 2019 18:14
Vote:
 

The code snippet you are using to set default value in SetDefaultValues are to set some actual value. You don't to initialize those with the Block types. This SetDefaultValues is in general used to set value to SelectionFactory type properties.When you are creating a property of some block type, it is not needed to initialize like new BlockType(). Removing that should resolve the issue.

Thanks

#210709
Dec 03, 2019 19:36
Vote:
 

Yea I'll give it a go not quite sure why it was implemented in this manner, only looked at the code as I was posting an update to this thread. 

#210711
Dec 03, 2019 20:22
Vote:
 

Yes, the below SetDefaultValues code is creating this issue in your case because it is not able to initialize the new object.

public override void SetDefaultValues(ContentType contentType)
        {
            base.SetDefaultValues(contentType);

            Image = new ImageBlock();
            CallToAction = new CallToActionButtonBlock();
        }

Removing this will solve the issue.

#210712
Edited, Dec 03, 2019 20:26
Vote:
 

Thanks just tested and confirmed to work 

#210713
Dec 03, 2019 20:29
Ravindra S. Rathore - Dec 03, 2019 20:30
Great !!!
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.