Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Computed value shown in CMS Editor


My scenario is rather simple:

I'd like to have a Page property that is automatically calculated (e.g. hashcode). I tried to achieve this by several ways but with no success, i.e.:

  • By having calculation in property getter and return value, like: get { return HashCode(); }
  • By using GetPropertyValue with default value.
  • By setting SetPropertyValue in getter and then use GetPropertyValue.
  • I had a mix combination of setter, i.e. empty setter and SetPropertyValue.

None of the above works fine, i.e. CMS Editor does not show calculated property. It's just an empty field.

What's the recommended way to achieve that?

May 22, 2020 12:27

Hello Dariusz

What problem are you trying to solve? 

If you want to set the value on model in Episerver you can override SetDefaults on the model itself if you want to initialise it when the content is created or use IContentEvents to hook into the content saving/saved events and update your value there.


May 22, 2020 14:12

Thank you for the answer David.

My case is to add the calculated property to one of the Block data type which belongs to several Page.

Hooking to the event is one of the solution, but it's complex. If I'd go with the generic solution, I'd have to scan each page if contains given block data type and then assign my calculated property there. Doable, but little but too complex for my needs.

In this case, I need to add HashCode to the block, but there are several other cases I need to have a property with some logic.

May 25, 2020 6:30
* 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.