Hi,
Alloy does, as far as I recall, use the [AllowedTypes(..)] attribute to restrict the types allowed in Content Areas. It is really simple to add. Episerver's UI will automatically change according to your configuration.
[AllowedTypes(AllowedTypes = new [] { typeof(MyBlockType) })] public virtual ContentArea ContentArea { get; set; }
More information is available here:
http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Content/Properties/Property-types/Restricting-content-types-in-properties/
Hope that was the answer you were looking for. :-)
Casper Aagaard Rasmussen
Sorry my question was not well worded.
So in alloy project when im in "on-page editing" i can also drag and drop stuff into a content area, around content area and change block settings:
also i have this options in "all properties" mode:
Image 2
But locally on my empty project i only get block options in "all properties", and in "on-page editing" i can only preview html without changing layout.
Hope i better explained what i whant to have.
Thx
Hi, Nemanja,
Which version are you on? And how do you render the ContentArea on the view, can you share it?
BR,
Marija
Hi,
ContentAreas should always be rendered via the @Html.PropertyFor(mo..) helper. That ensures that the necessary markup and scripting is applied when you are working in Edit mode.
<div> @Html.PropertyFor(model => model.ContentArea) </div>
It sounds to me like that is what you've left out. Joel Abrahamsson has written a detailed blog post covering the magic behind PropertyFor.
http://joelabrahamsson.com/how-episervers-html-helper-propertyfor-works/
You are highlighting a option called 'Display as: Full' in your screenshot. You can get all the information needed from the Developer Guide covering that exact topic.
http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/8/Rendering/Display-options/Display-options/
Hope that helped.
Casper Aagaard Rasmussen
Hi Marija And Casper,
Caspers aswer worked, i was using displayFor instead of PropertyFor. When i changed it started giving me same options on on-edit as on view all properties !
Thx
In alloy example when i'm on-page edditing mode i can drag and drop items in content area and there are options for blocks that are available in all-properties mode.
How can i enable this for content areas in new project without alloy downloaded.
Thx