AI OnAI Off
You should be able to override properties from inherited pages.
e.g.
public class Page1 : PageData { [Display( Name = @"Video Id", GroupName = BlockGroupNames.WebControls, Order = 20)] public virtual string VideoIdentifier { get; set; } } public class Page2 : Page1 { [Required, Display( Name = @"Video Id", GroupName = BlockGroupNames.WebControls, Order = 20)] public override string VideoIdentifier { get; set; } }
I'm unsure if you have to transfer all your attributes to "Page2" in this case.
The virtual property on the base class shouldn't matter.
Seems to work for me on Episerver 9.10.2.
[ContentType( DisplayName = "DummyPage", Description = "Dummy page for testing properties", GUID = "E03C5725-CE94-4C7C-92B7-15D51A8D7EE0", GroupName = "Default")] public class DummyPage : SitePageBase { [UIHint(UIHint.Textarea)] [CultureSpecific] [Display( Name = "String textarea", Description = "String textarea dummy", GroupName = SystemTabNames.Content, Order = 5)] public virtual string Textarea { get; set; } }
[ContentType( DisplayName = "DummyPage2", Description = "Dummy page for testing properties", GUID = "FA29D538-17CF-493E-80C0-DCB9DECF1C12", GroupName = "Default")] public class Dummy2 : DummyPage { [Required] public override string Textarea { get; set; } }
The value is persistent in the epi edit mode. I haven't tried to render it to any page but I can't see why it shouldn't work! :P
Hi Kevin Candlert,
Thank you, I saw what was my problem ;). In fact, what i was doing wrong is overriding the virtual property with the "new" keyword. When the view is rendered, this property didn't have value
Hi all,
I've one class called VideoWebControlBase where I have several properties, like: VideoIdentifier, Provider, etc. Example:
[Display(
Name = @"Video Id",
GroupName = BlockGroupNames.WebControls,
Order = 20)]
public virtual string VideoIdentifier { get; set; }
Then I've have a another class called SectionVideoWebControl that extends the base class with new properties that are required.
My question is: There is a way to make the VideoIdentifier required (putting the attribute [Required]) in the SectionVideoWebControl class?
Than you