c# - PiranhaCMS Page Type fields not displayed in editing form - Stack Overflow

admin2025-04-16  4

In PiranhaCMS i want to create custom page types that will store my data about Events. I created the type and added fields, but i cant see the editor for my new fields in CMS.

I am expecting to see the field in this setting. Setting screenshot

[PageType(Title = "Home page")]
[ContentTypeRoute(Title = "Default", Route = "/homepage")]
public class HomePage : Page<HomePage>
{
    [Field]
    public string EventName { get; set; }

    [Field]
    public StringField EventTitle { get; set; }
}

My interpretation of documentation is that this should work and I should see my fields, did I get that wrong or is there a different problem?

Thank you

I tried different fields like only string and only StringField/TextField. Even tried the region.

In PiranhaCMS i want to create custom page types that will store my data about Events. I created the type and added fields, but i cant see the editor for my new fields in CMS.

I am expecting to see the field in this setting. Setting screenshot

[PageType(Title = "Home page")]
[ContentTypeRoute(Title = "Default", Route = "/homepage")]
public class HomePage : Page<HomePage>
{
    [Field]
    public string EventName { get; set; }

    [Field]
    public StringField EventTitle { get; set; }
}

My interpretation of documentation is that this should work and I should see my fields, did I get that wrong or is there a different problem?

Thank you

I tried different fields like only string and only StringField/TextField. Even tried the region.

Share Improve this question asked Feb 3 at 22:22 ermoermo 11 silver badge1 bronze badge 1
  • According to the document:piranhacms.org/docs/master/content/pages ,there should be no public string EventName { get; set; } – Ruikai Feng Commented Feb 4 at 8:59
Add a comment  | 

1 Answer 1

Reset to default 0

I followed the instructions of SelArom Dot Net Tutorial - Customizing the Model with Regions and Fields and found out that I need to use new region to add fields or specify custom region attribute above custom field.

public class HomePage : Page<HomePage>
{
    [Region(Title = "General", Icon = "fas fa-pen")]
    public GeneralHomePageRegion General { get; set; }

}

public class GeneralHomePageRegion
{
    [Field(Title = "Caption", Description = "Max 50 characters")]
    public StringField Title { get; set; }
}
转载请注明原文地址:http://www.anycun.com/QandA/1744747100a87036.html