Answered by:
Change the display name of EntitySet fields in Dynamic Data

Question
-
User318430210 posted
Is it possible to change the display name of EntitySet fields?
Saturday, May 19, 2012 1:00 PM
Answers
-
User-330204900 posted
Actually the prefered method now is:
namespace DynamicData { [MetadataType(typeof(CompaniesMetaData))] public partial class Companies { } public class CompaniesMetaData { [Display(Name="Your Title Here")] public object Title { get; set; } } }
DisplayName is depreciated I think.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 21, 2012 4:30 AM
All replies
-
User-330204900 posted
Yes it is possible, by default it is the tables display name of the child table but you can customise it using the display Attribute.
Sunday, May 20, 2012 9:07 AM -
User318430210 posted
Thanks sjnaughton. I used the following code but it doesn't work.
[DisplayName("Manager")]
public EntitySet<Personnel> Personnel {get; set;}
Sunday, May 20, 2012 9:33 AM -
User3866881 posted
Hello karadous:)
I'm not sure where you've added the attribute……So please try this(suppose you have an entity called "Company",so——)You should do to create a partial class with another attribute called "MetadataType" and then do this below:
namespace DynamicData { [MetadataType(typeof(CompaniesMetaData))] public partial class Companies { } public class CompaniesMetaData { [DisplayName("Your Title Here")] public object Title { get; set; } } }
Sunday, May 20, 2012 9:26 PM -
User-330204900 posted
Actually the prefered method now is:
namespace DynamicData { [MetadataType(typeof(CompaniesMetaData))] public partial class Companies { } public class CompaniesMetaData { [Display(Name="Your Title Here")] public object Title { get; set; } } }
DisplayName is depreciated I think.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 21, 2012 4:30 AM -
User3866881 posted
sjnaughtonThanks!You are so kind to remind me of that……So you mean DisplayName is expired?
Tuesday, May 22, 2012 2:46 AM