Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
When you saying, inherited properties are missing, do you mean that it is not rendering data when you render or you are not getting in intellisense? Can you provide more details on how you are using them?
Your first example looks fine.
As Praful said, we probably need a little more context on what is missing—are you saying MainBody
is coming through null
?
In the first example the MainBody is null when the HtmlHelper.PropertyFor(x=>x.MainBody) tries to access it.
Could you please provide the complete code sample here. Like controller/viewmodel etc...
We are having the same problem where displaying the property without episerver html helpers works perfectly fine, yet breaks when using them.
So in this case,
@Model.MainBody doesn't throw any errors and works just fine
yet
@Html.PropertyFor(m => m.MainBody) can't seem to find the property...
I have pages that implements interfaces with inheritance. When I pass a page to a view that expects the interface, the inherited properties are missing.
public class StandardPage : PageData, IMainBody { [CultureSpecific] [Display(Name = "Main intro")] public virtual XhtmlString MainIntro { get; set; } [CultureSpecific] [Display(Name = "Main body")] public virtual XhtmlString MainBody { get; set; } } public interface IMainBody : IBody { } public interface IBody { XhtmlString MainBody { get; set; } }
I can add the property to both interfaces and then it works fine.
public class StandardPage : PageData, IMainBody { [CultureSpecific] [Display(Name = "Main intro")] public virtual XhtmlString MainIntro { get; set; } [CultureSpecific] [Display(Name = "Main body")] public virtual XhtmlString MainBody { get; set; } } public interface IMainBody : IBody { XhtmlString MainBody { get; set; } } public interface IBody { XhtmlString MainBody { get; set; } }
Am I misunderstanding how this should work, and this is expected?