Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
PTB returns the value of the property, not the property itself, and if the value is an int, you have to return an int, or something that is castable with an int.
If you want the property and not the value, just create a WeekdaysProperty that returns this.Property["Weekdays"] as PropertyWeekDay;
I use Page Type Builder 2 to define my page types. On one page type I have defined a property like so:
If I access it from my page template, I get an InvalidCastException with the message
Unable to cast object of type 'System.Int32' to type 'EPiServer.SpecializedProperties.PropertyWeekDay'.
I thought this would be handled automatically by PTB, but I guess not...
What do I need to do and where, if I want to use the property as a strongly typed PropertyWeekDay and not an int? What's the recommended approach?