Questions tagged [displayname-attribute]

Question about Display attribute from System.ComponentModel.DataAnnotations of .Net Framework.

Question about Display attribute from System.ComponentModel.DataAnnotations of .Net Framework.

Display attribute provides a general-purpose that lets you specify localizable strings for types and members of entity partial classes.

48 questions
6
votes
2 answers

Can I tell MVC to separate pascal-cased properties in to words automatically?

I often have C# code like [DisplayName("Number of Questions")] public int NumberOfQuestions { get; set; } Where I use the DisplayName property to add in spaces when it is displayed. Is there an option to tell MVC to add spaces by default…
user49438
  • 889
  • 7
  • 20
4
votes
1 answer

When is the "displayName" in a Google Calendar Event included and when it is not?

I have a Google Calendar that I share with a group of people. I am using the Google Calendar APis to read the events in this calendar. Now, the "displayName" of the attendees to an event is sometimes available and sometimes not. So my question is,…
malena
  • 798
  • 11
  • 26
4
votes
1 answer

Retrieve model name in custom display name attribute

Here is my development requirement, My label values are stored in the database, and I still want to use the data annotation in a declarative way, this is to make my model more readable. And here is my approach, I decided to write custom…
4
votes
2 answers

How to show Display Name for foreign key fields in ASP.NET MVC

I've seen many similar questions, but none seem to have a direct answer. When I attempt to add a Display(Name) attribute to a foreign key field, the Display Name isn't shown on the Create, Edit, Delete and Details form. I tried putting the attribute…
3
votes
2 answers

Enum DisplayName: Templates can be used only with field access

I know there are already other threads about this. I've been reading them. Here's what I've got: namespace Books.Entities { public enum Genre { [Display(Name = "Non Fiction")] NonFiction, Romance, Action, …
Casey Crookston
  • 13,016
  • 24
  • 107
  • 193
2
votes
2 answers

Get Display Name for License SKU in Microsoft Graph

I am trying to use Microsoft Graph to capture the products which we have licenses for. While I can get the skupartname, that name is not exactly display-friendly. I have come across DisplayName as a datapoint in almost all the API calls that give…
2
votes
1 answer

mvc DisplayName or Display(Name=...) depending on another model property

I have a model which has a string property and a enum property. I want the label, so DisplayName be different depending on the enum property value eg. public class DisplayItRight { public TypeEnum Type { get; set; } DisplayName(Type ==…
nickornotto
  • 1,946
  • 4
  • 36
  • 68
2
votes
1 answer

Best practice to implement globalization in MVC application

For form labels and alert messages which are client side, using resource file is heavy or not ? Shall I need separate implementation for client side specific strings using jquery and resource file for server side messages. Please let me know the…
1
vote
2 answers

Get DisplayName of property c#

I'm currently trying to get the displayname of a property in XAML (WPF) and tried to implement the answer of this question "Access DisplayName in xaml". To test this, I created a class with a property and the DisplayAttribute (I use localization…
tomo_2403
  • 15
  • 5
1
vote
0 answers

How to import the same component multiple times in order to set different displayNames?

I'm importing the Button component from our design-system. I want to import it multiple times by renaming it (e.g. import {Button as Btn, Button as MyBtn} from 'design-system' and then assign different displayName to them, via: Btn.displayName =…
Ale TheFe
  • 1,540
  • 15
  • 43
1
vote
2 answers

Displaying enum Display Name when iterating over enum values in Razor page (in ASP.NET Core)

How do you display the Display name for an enum when you're iterating over the enum values on a Razor Page (in ASP.NET Core)? Razor Page:
@foreach (var answer in…
Dan
  • 487
  • 5
  • 19
1
vote
1 answer

Jenkins LDAP - root DN & Display Name LDAP attribute

This question is about Jenkins LDAP root DN & Display Name LDAP attribute Environment:- Jenkins Version - 2.235.5(LTS) LDAP Plugin - 1.24 I am trying to configure LDAP(AD) Authentication in our Jenkins, Below is the configuration settings. root DN…
1
vote
2 answers

Using DisplayNameAttribute in DevExpress PivotGridControl

Is there any way to use [DisplayName] defined for each property as fields in a PivotGridControl? public class Dto { [DisplayName("Identifier")] public int Id {get;set;} [DisplayName("Number")] public string Num {get;set;} ... …
Masoud
  • 8,020
  • 12
  • 62
  • 123
1
vote
1 answer

Override default convention for DisplayNameFor()

I have lots of property names with PascalCase names. For example: public string ProposalNotes { get; set; } I am after overriding the default Html.DisplayNameFor() method to automatically split the property names to "Proposal Notes" without having…
CMB
  • 21
  • 6
1
vote
1 answer

Using reflection to obtain list of DisplayNames from Class properties

I'm trying to obtain a List of DisplayNames out of a class that has most of its properties booleans: public class AccessoriesModel { public int Id { get; set; } [Display(Name = "Acc 1")] public bool Accessory1 { get; set; } …
Ionea
  • 33
  • 1
  • 8
1
2 3 4