You could add a validator. See an example for ContentAreas in this thread:
http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=63002
This example validates the type of Content but you could easily change it to number of Blocks
Thanks Alf. That seems like it could work!
How would I keep track of how many blocks there are in the ContentArea, using that example as a starter?
You can look at the ContentArea.Contents for each Content/Block/Page added.
Use Linq methods such as .Count() to find out the amount.
If you want to re-use this validation on several Page Types, you can create a separate validator.
The value should be parsed to ContentArea instead of PageReference as is used in the example.
Hi guys,
What would be the best way limit the number of blocks allowed to be placed inside a ContentArea? Would this need to be a custom control or is there a way to limit this in the admin system?
I'm quite new to EPiServer, so if someone has some example code, that would be fabulous :-)
Cheers,
Chris