London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

SetDefaultValues on local block properties not possible?

Vote:
 

Does not seem to work ... data specified is not set.

The local block is inside another shared block, and i can set default values on other properties on the shared block (just not the properties on the local blocks)

#151402
Jul 20, 2016 16:00
Vote:
 

Have you tried to set the default values on the local block through the shared block's SetDefaultValues?

Example:

public override void SetDefaultValues(ContentType contentType)
{
	LocalBlock.PropertyOnLocalBlock = "value";
}

You probably know this, but also be aware of that SetDefaultValues only kicks in when creating the content type.

#151662
Aug 03, 2016 9:39
Vote:
 

Yeah your suggestion does not work. But I did find a solution ... strangely enough this works:

public override void SetDefaultValues(ContentType contentType)
{
    LocalBlock.Property["PropertyOnLocalBlock"].Value = "value";
}
#152029
Edited, Aug 12, 2016 18:01
Vladimir - Jun 15, 2023 17:30
what is LocalBlock in your example?
* 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.