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!

How to distribute page properties to other classes?


If I have an EPiServer page which contains a lot of properties, can I distribute the properties into subclasses to not have them all in one place?

It's an SPA and no blocks are used.

Apr 11, 2017 10:11

You can use normal inheritance with properties with the page class having both its own properties and the ones defined in a  base class.

You can also group related properties into blocks that are used as part of the page. It all depends on what you are trying to do.

Apr 11, 2017 10:32

A base class won't do. I'll need to distribute the page properties into multiple classes if possible. Then I will put 4-6 properties in each class. I'd like for every class to have a tab also.

Then each SPA view will have it's own class (and tab), but the classes all hang on the same EPiServer page which functions as a container.

I'd like not to use blocks for this.

Apr 11, 2017 13:49

Hi Bo,

It is possible to use partial classes in episerver cms.

For tabs, you can check out this link:

Apr 11, 2017 14:09

Tabs are assigned by decorating the propery with the Display attribute and setting its GroupName property. You can't split the class but you could declare the class partial to split the properties into multiple code files if that is any help. And you can of course use custom model classes for your views instead of the page class itself if you want to structure the data in another way.

If you really want to split the properties across multiple classes, you could use multiple pages (of different page types) even if only one of them has a view. This "main" page could have properties pointing to the other pages containing the additional data.

Apr 11, 2017 14:10
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.