On page editing for ContentArea not working

Vote:
 

I have added a new ContentArea to a page's model. 

When the ContentArea is rendered in the view, the on page editing for the area does not work. 

I am using PropertyFor.

Does anyone have any similar experiences with newly added ContentAreas not rendering as contentarea in one page editing?

#215765
Jan 13, 2020 12:03
Vote:
 

Hi Hannes,

Can you please add your code here so that we can look at the code because with the PropertyFor it should editable.

And please delete all the other duplicate questions.

#215770
Edited, Jan 13, 2020 13:43
Vote:
 

Are you using a view model? In that case, the view model property name must match the page type property name to support on page editing without extra effort. If you really want a different property name on the view model, you have to create a connection between the view model property and the page type property in your controller:

var editHints = ViewData.GetEditHints<MyViewModelType, MyPageType>();
editHints.AddConnection(vm => vm.CustomContentAreaPropertyName, pageType => pageType.ContentAreaPropertyName);

If you're not using a view model, does the ContentArea property belong to currentPage?

#215771
Edited, Jan 13, 2020 15:32
Hannes Carleson - Feb 11, 2020 12:35
Yes, that was it. The property name in the viewmodel did not match the model, thanks!
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.