.NET Enumeration Make it configurable to add spacing between words? #228
-
I really like the DataList with a .NET Enumeration as DataSource. 😄. Is there a way to stop adding spacing between words? In most cases it is really useful and inventive, but in some cases it is not. For example, if we are talking about social media. See the image below. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@erikjanwestendorp Do you have control over the enum code? If so, you could use the Similar to how the enum I have on the demo site: https://github.com/leekelleher/umbraco-contentment/blob/3.3.1/src/Umbraco.Cms.9.x/DataSources/RenderPosition.cs#L7 So for your example, you'd have something like... public enum SocialMedia
{
Facebook,
[DataListItem(Name = "LinkedIn")]
LinkedIn,
Twitter,
[DataListItem(Name = "WhatsApp")]
WhatsApp,
} Would that work for you? |
Beta Was this translation helpful? Give feedback.
-
@leekelleher Yes I have control over the enum code and annotate the field with the |
Beta Was this translation helpful? Give feedback.
@erikjanwestendorp Do you have control over the enum code? If so, you could use the
DataListItemAttribute
to annotate the field.Similar to how the enum I have on the demo site: https://github.com/leekelleher/umbraco-contentment/blob/3.3.1/src/Umbraco.Cms.9.x/DataSources/RenderPosition.cs#L7
So for your example, you'd have something like...
Would that work for you?