Try our conversational search powered by Generative AI!

Html.PropertyFor() not rending OnPage Edit controls on some pages

Vote:
 

I am following a similar approach to the Alloy MVC sample project with PageViewModel

Rendering Properties with @Html.PropertyFor(model=> model.CurrentPage.ContentAreaProperty) etc..

However on some of my PageTypes it doesn't render the On Page Editing controls for the properties.

i.e. For a ContentArea property I don't get any box rendered that allows me to drag content into.

Same for XHtmlString properties, I don't get the controls to allow me to initiate editing from On Page Editing View.

I can access the properties in Forms view, but I would really like to know why this fails to work on some pages and works on others.

I cannot see any difference in one that works and one that doesn't

I have stripped down my views to just have the ContentArea property and have no layout etc... in an attempt to trace any markup issues but still get no on page editing controls rendered.

Has anyone else experienced the same and if so, how did you overcome the issue ?

[ContentType(DisplayName = "MyPage", GUID = "d5d1acf3-8ba1-4ed9-8352-284c529e34e7", Description = "")]
    public class MyPage : PageData
    {
        [Display(Name = "Side Bar", Description = "Left hand side blocks")]
        public virtual ContentArea SideBar { get; set; }
    }
public class MyPageViewModel : PageViewModel
    {
        public MyPageViewModel(MyPage currentPage)
            : base(currentPage)
        {
           // Initialise viewmodel specific properties   
        }
    }
@model MyPageViewModel
@{
    Layout = null;
}

@Html.PropertyFor(model=>model.CurrentPage.SideBar)




#118905
Mar 17, 2015 10:02
Vote:
 

Hi, 

That's strange, do you get any errors in the console? Do you maybe have an obsolete property with some custom edit settings that you haven't cleaned up from admin mode?

What is the exact version of EPiServer?

BR,

Marija

#118912
Mar 17, 2015 11:40
Vote:
 

Hi Marija,

Thanks for your reply.

I don't get any console errors for the pages with the issue.

The page is really simple and no obsolete properties.

Since we can edit it from Forms mode, its not been a high priority, but its really bugging me. :)

I'm going to go through it one more time today and see what is different.

regards

Danny

#118913
Mar 17, 2015 11:58
Vote:
 

Hi, Danny,

I can bet it's annoying :D

Can you post the controller as well?

Is it some of the latest version of epi or older ones?

#118915
Mar 17, 2015 12:01
Vote:
 

Hi Marija,

Sorry yeah the EPiServer version is 7.18.

Controller:

[RequireHttpsIncDev]
    public class MyPageController : BasePageController<MyPage>
    {
        public ActionResult Index(MyPage currentPage)
        {
            var vm = new MyPageViewModel(currentPage);
            return View(vm);
        }
    }

I have just realised the problem while stripping down the Controller for posting here :)

Tests have confirmed its the RequireHttps attribute forcing my page to be loaded over https, whereas the CMS is loading over http.

If I load the CMS over https aswell then the edit mode controls appear as expected.

Thanks Marija for the Rubber Duck debugging! ;)

regards,

Danny

#118917
Mar 17, 2015 12:18
Vote:
 
<p>Haha, great I could "help"!</p> <p>Trully,&nbsp;</p> <p>Rubber duck&nbsp;</p>
#118918
Mar 17, 2015 13:02
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.