O'Reilly logo

Secrets of Real World ASP.NET Dynamic Data Web Sites by Craig Shoemaker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1.2. Understanding Model Metadata

The heart of Dynamic Data is the metadata defined in the model. There are many attributes available to apply to the model to change how a data field is rendered to the user. The following highlights some of the more common attributes used. Note that the attributes are found in the System.ComponentModel and System.ComponentModel.DataAnnotations namespaces.

using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;

[MetadataType(typeof(ContactMetadata))]
[DisplayColumn("LastName", "LastName")] public partial class Contact { } public class ContactMetadata { [DisplayName("Email Address")] [Required] [RegularExpression(@"^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$", ErrorMessage ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required