Hide property when creating block

Vote:
 

Hi!

How can I hide a property when creating a block, but showing the property on edit mode?

Also, is there a create content event? In that event, I want to set a property based on another property's value.

#121860
May 19, 2015 9:12
Vote:
 

To clarify, there is no preview mode for this block.

#121861
May 19, 2015 9:15
Vote:
 

If you are using form I think you can set the Editable attribute on the EPiServer:Property control that renders the property.

#121864
May 19, 2015 9:29
Vote:
 

Using [Editable(false)] will make the the property not editable neither on create mode nor edit mode. It's only when creating the block I want to hide the property.

#121866
May 19, 2015 9:36
Vote:
 

Sorry I missed that your block didn't have anya preview mode. 

#121868
May 19, 2015 10:16
Vote:
 

Hi,

If the property appears during block creation it's probably annotated with Required attribute. All properties with this attribute will be shown.

You could create you own validation rule (IValidate<T>), where you will check if the value is filled, but also if the PageLink.WorkId is not zero (it will be 0 for new pages). Then the required rule will be checked only during editing and the property won't be displayed in block craeting.

About second part of your question. You can subscribe to create event using code:

var contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>();
//contentEvents.CreatingContent += ...
//contentEvents.CreatingContent += ...

#121876
May 19, 2015 11:48
* 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.