November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi,
I have an error like you or similar where we not able to edit the properties on the OnPageEdit, it works fine with the FormsEdit.
I have contacted the support and the only thing I got from those was "this issue for now is not supported. We have sent the feedback to our developers and it will be looked at accordingly."
If you find any solution to this please share it.
@Magnus thanks for sharing that information. Good to know that "is not supported".
The solution so far in our project is mentioned earlier:
@{
Html.ViewContext.RequestContext.RouteData.Values["currentContent"] = null;
}
at the end of CustomBlock.cshtml
I have a block with one property:
I create a view (even not using Description) for it and I wire it together inside TemplateCoordinator, so it will be using my view when rendering.
I have an ArticlePage
In the View for ArticlePage:
When I am in Edit Mode the block is being rendered properly form MyImageBlock.cshtml but all properties after this one are rendered with EditMode wrappers and cannot be edited using OnPageEdit.
Investigation:
Down the road there is a method 'bool CurrentContentContainsProperty<TModel>(HtmlHelper<TModel> html, string propertyName)' which uses
'IContentData GetCurrentData<TModel>(HtmlHelper<TModel> html)'
The second method uses Html.ViewContext.RequestContext.RouteData.Values["currentContent"] and from my colleague investigation this has invalid value. It should not be set when use our custom MyImageBlock.cshtml. Actually the stupid workaround is to clear this value after rendering our block.
We don’t want to use Blocks with controller as it decrease performance and I remember from somewhere that EPiServer discourage it.
It’s all weird, and we can be wrong, or maybe we miss some small but important thing here. Epi guys, do you have a solution?