November Happy Hour will be moved to Thursday December 5th.

Generic property list - default value and required?

Vote:
 

Hi!

I'm using the new Generic PropertyList and it works great. However, I have some questions associated with it:

  1. How would you set a default value on a property which is defined on the model class? Like when you use SetDefaultValues?

  2. Is the Required-attribute supported for the properties?

Shout if you need a more detailed explanation of what I'm trying to achieve.

Thanks!

#206539
Aug 23, 2019 12:49
Vote:
 

Hi,

Two great questions:

  1. There is no easy way to do this, however, there is a blog post that'll take you through it: https://beendaved.blogspot.com/2018/10/defaultvalue-in-propertylist.html
  2. Yes, it supports Required

I should add, as per the Episerver documentation: "Episerver recommends using ContentArea and Blocks for lists of complex objects." With the continued improvements to EPiServer.Labs.BlockEnhancements you might consider using that instead (it allows inline block editing and smart publishing, see this blog post and this one as well).

#206553
Edited, Aug 23, 2019 16:26
Vote:
 

Hi Jake,

And thanks for the answer!

However, I still think EPiServer should support default values for property lists out of the box. At least when none of the properties are complex types.

And as for blocks...they're great but BlockEnhancements is also still in Labs and should be used "as is". Think they should focus on getting things 100% done and ready.

#206615
Aug 27, 2019 8:15
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.