Just another WordPress.com site

Data Annotations

  1. Validation Annotations:

using System.ComponentModel.DataAnnotations;
namespace PartyInvites.Models {
public class GuestResponse {
[Required(ErrorMessage=”Please enter your name”)]
public string Name { get; set; }
[Required(ErrorMessage=”Please enter your email address”)]
[RegularExpression(“.+\\@.+\\..+”,ErrorMessage=”Please enter a valid email address”)]
public string Email { get; set; }
[Required(ErrorMessage=”Please enter your phone number”)]
public string Phone { get; set; }
[Required(ErrorMessage=”Please specify whether you’ll attend”)]
public bool? WillAttend { get; set; }


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: