Skip to content

Desi banjara

learn and grow together

  • Azure
    • Azure Compute
      • Azure Logic Apps
      • Azure Mobile Apps
      • Azure App Service
      • Azure Serverless Computing
        • Azure Functions
    • Azure Networking services
      • Azure Networking – VNET
    • Azure Database Services
      • Azure SQL
      • Azure Data Factory
      • Azure Databricks
    • Azure Analytics Services
    • Azure Cognitive Services
    • Azure Data and Storage
    • Azure Devops
    • Azure landing zone
    • Azure IaaS
    • Azure Internet of Things (IoT)
      • Azure Machine Learning
      • Azure AI and ML services
    • Azure Migration
    • Microsoft Azure Log Analytics
  • Azure Security
    • Azure Identity and Access Management
    • Azure Active Directory
    • Azure Defender
    • Azure security tools for logging and monitoring
    • Azure Sentinel
    • Azure Sentinel – Data connectors
  • Agile Software development
    • Atlassian Jira
  • Amazon Web Services (AWS)
    • Amazon EC2
    • Amazon ECS
    • AWS Lambda
  • Google
    • Google Cloud Platform (GCP)
    • gmail api
    • Google Ads
    • Google AdSense
    • Google Analytics
    • Google Docs
    • Google Drive
    • Google Maps
    • Google search console
  • Software architecture
    • Service-oriented architecture (SOA)
    • Domain-Driven Design (DDD)
    • Microservices
    • Event-Driven Architecture
    • Command Query Responsibility Segregation (CQRS) Pattern
    • Layered Pattern
    • Model-View-Controller (MVC) Pattern
    • Hexagonal Architecture Pattern
    • Peer-to-Peer (P2P) pattern
    • Pipeline Pattern
  • Enterprise application architecture
  • IT/Software development
    • API development
    • ASP.Net MVC
    • ASP.NET Web API
    • C# development
    • RESTful APIs
  • Cybersecurity
    • Cross Site Scripting (XSS)
    • Reflected XSS
    • DOM-based XSS
    • Stored XSS attacks
    • Ransomware
    • cyber breaches
    • Static Application Security Testing (SAST)
  • Interview questions
    • Microsoft Azure Interview Questions
    • Amazon Web Services (AWS) Interview Questions
    • Agile Software development interview questions
    • C# interview questions with answers
    • Google analytics interview questions with answers
    • Javascript interview questions with answers
    • Python interview questions with answers
    • WordPress developer interview questions and answers
  • Cloud
    • Cloud computing
    • Infrastructure as a Service (IaaS)
    • Platform as a Service (PaaS)
    • Software as a Service (SaaS)
    • Zero Trust strategy
  • Toggle search form
  • Azure Database Services Azure Database Services
  • Azure Serverless Computing Azure Serverless Computing
  • Configure SSL offloading with Azure Load Balancer Azure Load Balancer
  • Migrating your workloads to azure IaaS Azure
  • How can I run web and api projects together in visual studio ASP.NET Core
  • From $0 to $10K/Month Writing Online – The Exact Roadmap to Build a Profitable Writing Career AI Writing & Automation
  • Why cyber breaches are expected to increase? cyber breaches
  • Azure Cosmos DB Azure Cosmos DB

ASP.NET MVC – Differences between DisplayName and Display Attributes

Posted on March 23, 2023 By DesiBanjara No Comments on ASP.NET MVC – Differences between DisplayName and Display Attributes
DisplayName Attribute:

The DisplayName attribute is used to specify the display name of a model property. It is typically used in conjunction with the EditorFor and DisplayFor HTML helpers to render the property name in the UI. The DisplayName attribute can be applied to either a property or a class, and it can take a single argument, which is the display name of the property. Here’s an example:

ASP.NET MVC DisplayName Attribute

 

 

 

 

In this example, the DisplayName attribute is used to specify the display names of the FirstName and LastName properties of the Customer class. When the EditorFor or DisplayFor HTML helpers are used to render the properties, they will display the specified display names (“First Name” and “Last Name”) instead of the property names (“FirstName” and “LastName”).

Display Attribute:

The Display attribute is used to specify various metadata about a model property, including the display name, the order in which the property should be displayed, and the format in which it should be displayed. The Display attribute can be applied to either a property or a class, and it takes several arguments that can be used to specify different metadata. Here’s an example:

ASP.NET MVC - Display Attribute

In this example, the Display attribute is used to specify the display names and the order of the FirstName and LastName properties of the Customer class. The Name argument is used to specify the display name, and the Order argument is used to specify the order in which the properties should be displayed. When the EditorFor or DisplayFor HTML helpers are used to render the properties, they will display the specified display names (“First Name” and “Last Name”) in the specified order (1 and 2).

Differences between DisplayName and Display Attributes:

The main difference between the DisplayName and Display attributes is that the DisplayName attribute is used only to specify the display name of a model property, whereas the Display attribute can be used to specify various metadata, including the display name, the order, and the format. Additionally, the DisplayName attribute can take only a single argument, which is the display name, whereas the Display attribute can take multiple arguments that can be used to specify different metadata.

Both the DisplayName and Display attributes are useful in ASP.NET MVC for specifying the display name of a model property. However, the Display attribute provides more flexibility by allowing you to specify various metadata, including the display name, the order, and the format. The choice between the two attributes will depend on your specific requirements and the level of metadata that you need to specify.

ASP.NET Core, ASP.Net MVC Tags:ASP.Net MVC, Display Attribute, DisplayName Attribute, displayname attribute vs display attribute

Post navigation

Previous Post: Peer-to-Peer (P2P) pattern
Next Post: WordPress

Related Posts

  • How can I run web and api projects together in visual studio ASP.NET Core
  • Add Google Maps in ASP.NET core web application ASP.NET Core
  • ASP.NET Core – How to show total number of users in each country on google map? ASP.NET Core
  • Deploy ASP.NET Core apps to Azure App Service ASP.NET Core
  • How to make API call to invite user and keep user on same page but change button title to invited? ASP.NET Core

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.



Categories

  • Agile Software development
  • AI Writing & Automation
  • Amazon EC2
  • Amazon Web Services (AWS)
  • Apache Kafka
  • API development
  • Apple Mac
  • ARM templates
  • Artificial intelligence
  • ASP.NET Core
  • ASP.Net MVC
  • Atlassian Jira
  • AWS Lambda
  • Azure
  • Azure Active Directory
  • Azure AD B2C
  • Azure AD Domain Services
  • Azure AI and ML services
  • Azure Analytics Services
  • Azure App Service
  • Azure Application Gateway
  • Azure Archive Storage
  • Azure Blob Storage
  • Azure Cache for Redis
  • Azure Cognitive Services
  • Azure Compute
  • Azure Container Instances (ACI)
  • Azure Core Services
  • Azure Cosmos DB
  • Azure Data and Storage
  • Azure Data Factory
  • Azure Data Lake Storage
  • Azure Database for MySQL
  • Azure Database for PostgreSQL
  • Azure Database Migration Service
  • Azure Database Services
  • Azure Databricks
  • Azure DDoS Protection
  • Azure Defender
  • Azure Devops
  • Azure Disk Storage
  • Azure ExpressRoute
  • Azure File Storage
  • Azure Firewall
  • Azure Functions
  • Azure HDInsight
  • Azure IaaS
  • Azure Identity and Access Management
  • Azure Internet of Things (IoT)
  • Azure Key Vault
  • Azure Kubernetes Service (AKS)
  • Azure landing zone
  • Azure Lighthouse
  • Azure Load Balancer
  • Azure Logic Apps
  • Azure Machine Learning
  • Azure Machine Learning
  • Azure Migration
  • Azure Mobile Apps
  • Azure Network Watcher
  • Azure Networking – VNET
  • Azure Networking services
  • Azure Pricing and Support
  • Azure Queue Storage
  • Azure Resource Manager
  • Azure Security
  • Azure Security Center
  • Azure Security Information and Event Management (SIEM)
  • Azure security tools for logging and monitoring
  • Azure Security, Privacy, Compliance, and Trust
  • Azure Sentinel
  • Azure Sentinel – Data connectors
  • Azure Serverless Computing
  • Azure Service Level Agreement (SLA)
  • Azure SLA calculation
  • Azure SQL
  • Azure SQL Database
  • Azure Storage
  • Azure Stream Analytics
  • Azure Synapse Analytics
  • Azure Table Storage
  • Azure Virtual Machine
  • Azure VPN Gateway
  • Blogging
  • Business
  • C# development
  • CDA (Clinical Document Architecture)
  • ChatGPT
  • CI/CD pipeline
  • Cloud
  • Cloud computing
  • Cloud Computing Concepts
  • Cloud FinOps
  • Cloud FinOps Optmisation
  • Cloud services
  • COBIT
  • Command Query Responsibility Segregation (CQRS) Pattern
  • Configure SSL offloading
  • Content Creation
  • Content management system
  • Continuous Integration
  • conversational AI
  • Cross Site Scripting (XSS)
  • cyber breaches
  • Cybersecurity
  • Data Analysis
  • Data Clean Rooms
  • Data Engineering
  • Data Warehouse
  • Database
  • DeepSeek AI
  • DevOps
  • DevSecOps
  • Docker
  • DOM-based XSS
  • Domain-Driven Design (DDD)
  • Dynamic Application Security Testing (DAST)
  • Enterprise application architecture
  • Event-Driven Architecture
  • git
  • gmail api
  • Google
  • Google Ads
  • Google AdSense
  • Google Analytics
  • Google Cloud Platform (GCP)
  • Google Docs
  • Google Drive
  • Google Flights API
  • Google Maps
  • Google search console
  • Healthcare Interoperability Resources
  • Hexagonal Architecture Pattern
  • IBM qradar
  • Internet of Things (IoT)
  • Interview questions
  • Introduction to DICOM
  • IT governance
  • IT Infrastructure networking
  • Kubernetes
  • Layered Pattern
  • Load Balancing Algorithms
  • Microservices
  • Microservices
  • Microsoft
  • Microsoft 365 Defender
  • Microsoft AZ-900 Certification Exam
  • Microsoft Azure
  • Microsoft Azure Log Analytics
  • Microsoft Cloud Adoption Framework
  • Microsoft Teams
  • Microsoft Teams
  • Model-View-Controller (MVC) Pattern
  • Monitoring and analytics
  • NoSQL
  • OpenAI
  • Peer-to-Peer (P2P) pattern
  • Pipeline Pattern
  • PL-100: Microsoft Power Platform App Maker
  • Postman
  • Project management
  • Rally software
  • Ransomware
  • Reflected XSS
  • RESTful APIs
  • Rich Text Editor
  • SC-100: Microsoft Cybersecurity Architect
  • Scrum Master Certification
  • Service-oriented architecture (SOA)
  • SIEM
  • Software architecture
  • Splunk
  • SQL
  • Static Application Security Testing (SAST)
  • Stored XSS attacks
  • System Design Interview
  • Test Driven Development (TDD)
  • TinyMCE
  • Top technology trends for 2023
  • Uncategorized
  • User Experience (UX) design
  • Version control system
  • virtual machine scale set
  • visual studio
  • Web development
  • Windows Hello
  • WordPress
  • WordPress developer interview questions and answers
  • Zero Trust strategy



Recent Posts

  • Ace Your FAANG System Design Interview like Google & Amazon: The 8 Whitepapers You Must Read
  • From $0 to $10K/Month Writing Online – The Exact Roadmap to Build a Profitable Writing Career
  • How to Write an AI-Generated Article That Feels 100% Human Using ChatGPT
  • DeepSeek AI: The OpenAI Rival You Didn’t See Coming (But Should)
  • 10 Ways AI is Revolutionizing Healthcare (And Why Your Doctor Might Just Be a Robot Soon)
  • Design a zero trust strategy and architecture in azure Zero Trust strategy
  • Get started with Azure Kubernetes Service (AKS) Azure Kubernetes Service (AKS)
  • WordPress Content management system
  • Get started with Azure Cosmos DB Azure Cosmos DB
  • Azure Resource Manager Azure
  • ASP.NET Core – How to show total number of users in each country on google map? ASP.NET Core
  • Layered Pattern Layered Pattern
  • Azure Queue Storage Azure Queue Storage

Copyright © 2025 Desi banjara.

Powered by PressBook News WordPress theme