Search code examples
sitecoresitecore-mvc

How to validate number of renderings on item


How do i perform validation on number of rendering applied on any item.
i want to restrict rendering with placeholder say 'xyz' to 3 i.e that rendering with placeholder 'xyz' should not exceed 3 times on item.
e.g. if i apply rendering 'rend_card' more than 3 times on item. then it should show me validation error.


Solution

  • If you are have MVC solution check this link : https://ctor.io/limit-the-number-of-components-in-a-sitecore-placeholder/

    If you are using Web Forms check : http://www.newguid.net/sitecore/2014/restricting-the-number-of-components-in-the-sitecore-page-editor/