Edit only one field from block




Is it possible to have only one editable field from the block on the page. What I mean:

I have a block with a field:

[Display(Name = "Page header", Description = "Page Header", GroupName = Global.GroupNames.Labels, Order = 10)]
            public virtual String PageHeader { get; set; }

This block is present as a property in a page data class:

public virtual BasePageSettingsBlock BasePageSettings{ get; set; } << this block contains PageHeader property.


In a view I want this field to be editable, so I write a PropertyFor for the field PageHeader:

@Html.PropertyFor(x => x.CurrentPage.BasePageSettings.PageHeader)

but it doesn't editable in edit mode. It is editable prperties view, or if I write PropertyFor for the whole block. Is it possible to have only this field editable in edit mode?


Apr 08, 2014 17:36

you could try to have a uiHint on hat property and then create a display template for it.  Then you can render it based on that.

if you only want that visible on ediitng, you can put PageEditing.PageIsInEditMode as well and then display a different view when rendered outside of edit mode.
public virrtual basepageseettingsblock basepagesettings{get;set;}

then you create a PageHeader.cshtml file in display templates.  I am not sure if it will work but worth a shot.  Let me kow how it goes.

Apr 10, 2014 4:56

I would certainly expect this sub property to be editable just as any other field. I'll do an investigation to see if this is a bug/glitch...

Apr 10, 2014 8:22
* 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.