Limit number of blocks

Vote:
 

Is there a way to limit the number of blocks a user can insert into a block container? The design is only for 3 items, so I don't want my client to be adding more than that.

#120073
Apr 09, 2015 18:26
Vote:
 

Not sure if you can limit it directly in the UI, but you can limit it when saving the page. See this article: http://world.episerver.com/code/dannymurphy/contentarea-item-limiting/

#120074
Apr 09, 2015 18:39
Vote:
 

Another option could be to create your own ContentAreaRenderer and do your magic there. I wrote a blog article about manipulating a single item but I think you could change how all items are rendered. http://www.kloojed.com/render-contentarea-items-with-ehm-spacing/

/Marcus

#120078
Apr 09, 2015 22:42
Vote:
 

Have a look at Henriks blog post for an example of how to implement custom validation to do that: 

http://henrikm.com/custom-episerver-property-validation/

Paul

#120093
Edited, Apr 10, 2015 8:46
Vote:
 

Thank you, Paul - Henrik's solution works well enough for my purposes. I appreciate your help!

#120145
Apr 10, 2015 16:17
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.