Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Edit only one field from block

Vote:
 

Hi,

 

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?

 

#84879
Apr 08, 2014 17:36
Vote:
 

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.
[UIHint("PageHeader")]
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.

#84944
Apr 10, 2014 4:56
Vote:
 

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...

#84951
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.